microsoft / DevHomeAzureExtension

Dev Home Azure Extension
MIT License
77 stars 16 forks source link

Adding framework & partial token retrieval code #51

Closed huzaifa-d closed 10 months ago

huzaifa-d commented 10 months ago

Summary of the pull request

This PR adds the framework to add Dev Box functionality to the extension. Dev Boxes are cloud VMs offered by Microsoft. This PR is part of changes that will enable Dev Home to list and control Dev Boxes.

Detailed description of the pull request / Additional comments

This PR adds the Dependency Injection framework that will be used by the feature. It also includes the Authentication methods that leverage the existing developer id code to get access tokens needed to make REST calls by the feature.

Diagram idea credit @bbonaby

sequenceDiagram
    Dev Home->>AzureExt(DevBoxProvider): GetComputeSystemsAsync()
    AzureExt(DevBoxProvider)->>ManagementService: Get all dev center projects for user
    ManagementService->>AuthenticationService: Get HTTP Client to use
    AuthenticationService->>TokenService: Get token to use
    TokenService-->>AuthenticationService: Returns AzureResourceManager token
    AuthenticationService-->>ManagementService: Returns HTTP Client w/ ARM token    
    ManagementService-->>AzureExt(DevBoxProvider): Returns projects
    AzureExt(DevBoxProvider)->>ManagementService: Get all dev boxes under project
    ManagementService->>AuthenticationService: Get HTTP Client to use
    AuthenticationService->>TokenService: Get token to use
    TokenService-->>AuthenticationService: Returns Data Plane token
    AuthenticationService-->>ManagementService: Returns Client w/ Data Plane token  
    ManagementService-->>AzureExt(DevBoxProvider): Returns Dev Boxes    
    AzureExt(DevBoxProvider)->>ManagementService: Get dev boxes' details
    ManagementService->>AuthenticationService: Get HTTP Client to use
    AuthenticationService-->>ManagementService: Returns Client w/ Data Plane token  
    ManagementService-->>AzureExt(DevBoxProvider): Returns details
    AzureExt(DevBoxProvider)-)Dev Home: Returns List of IComputeSystems

Validation steps performed

Unit Tests Manual validation

Note: Currently the PR doesn't build since it uses a SDK that has ComputeSystem changes as needed for this feature.