- 
                Notifications
    
You must be signed in to change notification settings  - Fork 32
 
✨ Expose licensing endpoints in api server #7009
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
            bisgaard-itis
  merged 35 commits into
  ITISFoundation:master
from
bisgaard-itis:6948-expose-licensing-endpoints-in-api-server
  
      
      
   
  Jan 9, 2025 
      
    
  
     Merged
                    Changes from 28 commits
      Commits
    
    
            Show all changes
          
          
            35 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      80c1223
              
                @matusdrobuliak66 add license key to api-server model
              
              
                bisgaard-itis c82f397
              
                refactoringh
              
              
                bisgaard-itis 8a79348
              
                expose get_available_licensed_items_for_wallet in api-server
              
              
                bisgaard-itis cf218a1
              
                expose checkout endpoint
              
              
                bisgaard-itis d6525ef
              
                start exposing final endpoint
              
              
                bisgaard-itis 237bd93
              
                expose final endpoint
              
              
                bisgaard-itis 8240f47
              
                refactor licensed items tests
              
              
                bisgaard-itis f794286
              
                add some tests for exceptions
              
              
                bisgaard-itis 7d4ace4
              
                Merge branch 'master' into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis 6c3682c
              
                update to latest master changes
              
              
                bisgaard-itis 09003df
              
                merge master into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis 4758760
              
                resolve issues caused by merging master
              
              
                bisgaard-itis 7caaa0e
              
                merge master into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis 1d22b01
              
                make pylint happy
              
              
                bisgaard-itis 8e4e18d
              
                merge master into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis e21c8aa
              
                add test for checking out licensed item
              
              
                bisgaard-itis 9ede5af
              
                add error handling to checkout endpoint
              
              
                bisgaard-itis 6c4f1a6
              
                minor correction
              
              
                bisgaard-itis 964bb67
              
                ruff
              
              
                bisgaard-itis 97f8d7d
              
                add rpc client for resource usage tracker
              
              
                bisgaard-itis 0c0312a
              
                add endpoint for releasing a checked out item
              
              
                bisgaard-itis 7beac73
              
                add exception handling to release endpoint
              
              
                bisgaard-itis ce7fc12
              
                make test pass
              
              
                bisgaard-itis baed7ba
              
                add more parameters to test
              
              
                bisgaard-itis ae332a6
              
                Merge branch 'master' into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis 35c930e
              
                fix wrong import
              
              
                bisgaard-itis c2ccce1
              
                merge master into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis e37ccf2
              
                @pcrespov int -> PositiveInt
              
              
                bisgaard-itis 3d3b3f4
              
                @sanderegg @pcrespov handle cast
              
              
                bisgaard-itis f69a4b8
              
                @pcrespov use SingletonInAppStateMixin
              
              
                bisgaard-itis 239fb66
              
                @GitHK TimeoutError -> asyncio.TimeoutError
              
              
                bisgaard-itis 893cdc0
              
                Merge branch 'master' into 6948-expose-licensing-endpoints-in-api-server
              
              
                bisgaard-itis e1b54ea
              
                assert type
              
              
                bisgaard-itis 642c474
              
                nosec
              
              
                bisgaard-itis 5e0fba5
              
                resolve type issue
              
              
                bisgaard-itis File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            13 changes: 13 additions & 0 deletions
          
          13 
        
  .../api-server/src/simcore_service_api_server/api/dependencies/resource_usage_tracker_rpc.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from typing import Annotated, cast | ||
| 
     | 
||
| from fastapi import Depends, FastAPI | ||
| from servicelib.fastapi.dependencies import get_app | ||
| 
     | 
||
| from ...services_rpc.resource_usage_tracker import ResourceUsageTrackerClient | ||
| 
     | 
||
| 
     | 
||
| async def get_resource_usage_tracker_client( | ||
| app: Annotated[FastAPI, Depends(get_app)] | ||
| ) -> ResourceUsageTrackerClient: | ||
| assert app.state.resource_usage_tracker_rpc_client # nosec | ||
| return cast(ResourceUsageTrackerClient, app.state.resource_usage_tracker_rpc_client) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            3 changes: 2 additions & 1 deletion
          
          3 
        
  services/api-server/src/simcore_service_api_server/exceptions/handlers/_utils.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
        
          
  
    
      
          
            7 changes: 7 additions & 0 deletions
          
          7 
        
  services/api-server/src/simcore_service_api_server/models/schemas/licensed_items.py
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from models_library.services_types import ServiceRunID | ||
| from pydantic import BaseModel, PositiveInt | ||
| 
     | 
||
| 
     | 
||
| class LicensedItemCheckoutData(BaseModel): | ||
                
      
                  bisgaard-itis marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| number_of_seats: PositiveInt | ||
| service_run_id: ServiceRunID | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.