-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from microsoft/staging
Release - 3/18/24
- Loading branch information
Showing
107 changed files
with
3,272 additions
and
146 deletions.
There are no files selected for viewing
This file contains 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 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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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 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 |
---|---|---|
|
@@ -177,7 +177,8 @@ private bool InitializeIsValidFormat() | |
return false; | ||
} | ||
|
||
if (Uri.Scheme != Uri.UriSchemeHttps) | ||
// Hosted supports https, but on-prem can support http. | ||
if (Uri.Scheme != Uri.UriSchemeHttps && Uri.Scheme != Uri.UriSchemeHttp) | ||
{ | ||
return false; | ||
} | ||
|
@@ -205,6 +206,9 @@ private bool InitializeIsValid() | |
|
||
return false; | ||
|
||
case AzureHostType.NotHosted: | ||
return true; | ||
|
||
default: | ||
return false; | ||
} | ||
|
@@ -236,6 +240,10 @@ private string InitializeOrganization() | |
return Uri.Host.Replace(".visualstudio.com", string.Empty, StringComparison.OrdinalIgnoreCase); | ||
} | ||
|
||
case AzureHostType.NotHosted: | ||
// Not hosted (i.e. On-prem server) can be anything, we assume it is the hostname. | ||
return Uri.Host; | ||
|
||
default: | ||
return string.Empty; | ||
} | ||
|
@@ -283,7 +291,7 @@ private string InitializeProject() | |
// If one does not exist, it will be the last segment. | ||
var targetSegment = APISegmentIndex > 1 ? APISegmentIndex - 1 : 1; | ||
var hostTypeOffset = 0; | ||
if (HostType == AzureHostType.Legacy) | ||
if (HostType == AzureHostType.Legacy || HostType == AzureHostType.NotHosted) | ||
{ | ||
hostTypeOffset = -1; | ||
} | ||
|
@@ -476,6 +484,17 @@ private Uri InitializeConnection() | |
|
||
break; | ||
|
||
case AzureHostType.NotHosted: | ||
// Onprem includes the collection. | ||
var onpremUriString = Uri.Scheme + "://" + Uri.Authority; | ||
onpremUriString = onpremUriString.TrimEnd('/') + '/'; | ||
if (!Uri.TryCreate(onpremUriString, UriKind.Absolute, out newUri)) | ||
{ | ||
Log.Logger()?.ReportError($"Failed creating On-Prem Uri: {Uri} UriString: {onpremUriString}"); | ||
} | ||
|
||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
@@ -508,6 +527,7 @@ private Uri InitializeOrganizationLink() | |
} | ||
|
||
break; | ||
|
||
case AzureHostType.Modern: | ||
// https://[email protected]/organization/project/_git/repository from clone window | ||
// https://dev.azure.com/organization/project/_git/repository from repo url window | ||
|
@@ -519,6 +539,16 @@ private Uri InitializeOrganizationLink() | |
} | ||
|
||
break; | ||
|
||
case AzureHostType.NotHosted: | ||
var onpremOrgUri = Uri.Scheme + "://" + Uri.Host; | ||
if (!Uri.TryCreate(onpremOrgUri, UriKind.Absolute, out orgUri)) | ||
{ | ||
Log.Logger()?.ReportError("Could not make Org Uri"); | ||
} | ||
|
||
break; | ||
|
||
default: | ||
break; | ||
} | ||
|
This file contains 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 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 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 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,12 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Windows.DevHome.SDK; | ||
|
||
namespace AzureExtension.Contracts; | ||
|
||
// ARMTokenService is a service that provides an Azure Resource Manager (ARM) token. | ||
public interface IArmTokenService | ||
{ | ||
public Task<string> GetTokenAsync(IDeveloperId? devId); | ||
} |
This file contains 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,11 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Windows.DevHome.SDK; | ||
|
||
namespace AzureExtension.Contracts; | ||
|
||
public interface IDataTokenService | ||
{ | ||
public Task<string> GetTokenAsync(IDeveloperId? devId); | ||
} |
This file contains 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 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using Microsoft.Windows.DevHome.SDK; | ||
|
||
namespace AzureExtension.Contracts; | ||
|
||
public interface IDevBoxAuthService | ||
{ | ||
HttpClient GetManagementClient(IDeveloperId? devId); | ||
|
||
HttpClient GetDataPlaneClient(IDeveloperId? devId); | ||
} |
This file contains 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,30 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using AzureExtension.DevBox; | ||
using AzureExtension.DevBox.Models; | ||
using Microsoft.Windows.DevHome.SDK; | ||
|
||
namespace AzureExtension.Contracts; | ||
|
||
public interface IDevBoxCreationManager | ||
{ | ||
public bool TryGetDevBoxInstanceIfBeingCreated(string id, out DevBoxInstance? devBox); | ||
|
||
/// <summary> | ||
/// Initiates the Dev box creation process. The operation is started, and a request is made to the Dev Center who will | ||
/// then create the Dev Box. | ||
/// </summary> | ||
/// <param name="operation">An object that implements Dev Homes <see cref="ICreateComputeSystemOperation"/> interface to relay progress data back to Dev Home</param> | ||
/// <param name="developerId">The developer to authenticate with</param> | ||
/// <param name="parameters">User json input provided from Dev Home</param> | ||
public Task<CreateComputeSystemResult> StartCreateDevBoxOperation(CreateComputeSystemOperation operation, IDeveloperId developerId, DevBoxCreationParameters parameters); | ||
|
||
/// <summary> | ||
/// Starts the process of monitoring the provisioning status of the Dev Box. This is needed for the cases where a Dev Box was created | ||
/// out side of the extension. But the creation operation is still in progress. | ||
/// </summary> | ||
/// <param name="developerId">The developer to authenticate with</param> | ||
/// <param name="devBox">The Dev Box instance to monitor</param> | ||
public void StartDevBoxProvisioningStateMonitor(IDeveloperId developerId, DevBoxInstance devBox); | ||
} |
This file contains 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,46 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System.Text.Json; | ||
using AzureExtension.DevBox.Models; | ||
using Microsoft.Windows.DevHome.SDK; | ||
|
||
namespace AzureExtension.Contracts; | ||
|
||
public interface IDevBoxManagementService | ||
{ | ||
/// <summary> | ||
/// Makes an Https request to the azure management plane of the Dev Center. | ||
/// </summary> | ||
/// <param name="webUri">The Uri of the request.</param> | ||
/// <param name="developerId">The DeveloperId associated with the request.</param> | ||
/// <param name="method">The type of the the http request. E.g Get, Put, Post etc.</param> | ||
/// <param name="requestContent">The content that should be used with the request.</param> | ||
/// <returns>The result of the request.</returns> | ||
public Task<DevBoxHttpsRequestResult> HttpsRequestToManagementPlane(Uri webUri, IDeveloperId developerId, HttpMethod method, HttpContent? requestContent); | ||
|
||
/// <summary> | ||
/// Makes an Https request to the azure data plane of the Dev Center. | ||
/// </summary> | ||
/// <param name="webUri">The Uri of the request.</param> | ||
/// <param name="developerId">The DeveloperId associated with the request.</param> | ||
/// <param name="method">The type of the the http request. E.g Get, Put, Post etc.</param> | ||
/// <param name="requestContent">The content that should be used with the request.</param> | ||
/// <returns>The result of the request.</returns> | ||
public Task<DevBoxHttpsRequestResult> HttpsRequestToDataPlane(Uri webUri, IDeveloperId developerId, HttpMethod method, HttpContent? requestContent); | ||
|
||
/// <summary> | ||
/// Generates a list of objects that each contain a Dev Center project and the Dev Box pools associated with that project. | ||
/// </summary> | ||
/// <param name="projectsJson">The Json recieved from a rest api that returns a list of Dev Center projects.</param> | ||
/// <param name="developerId">The DeveloperId associated with the request.</param> | ||
/// <returns>A list of objects where each contain a project and its associated pools.</returns> | ||
public Task<List<DevBoxProjectAndPoolContainer>> GetAllProjectsToPoolsMappingAsync(JsonElement projectsJson, IDeveloperId developerId); | ||
|
||
/// <summary> | ||
/// Initiates a call to create a Dev Box in the Dev Center. | ||
/// </summary> | ||
/// <param name="parameters">The parameters used to create the Dev Box.</param> | ||
/// <param name="developerId">The DeveloperId associated with the request.</param> | ||
public Task<DevBoxHttpsRequestResult> CreateDevBox(DevBoxCreationParameters parameters, IDeveloperId developerId); | ||
} |
Oops, something went wrong.