diff --git a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md index d7ebb6e9a8b3..553708b165b1 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md @@ -1,11 +1,17 @@ # Release History -## 1.0.0-beta.4 (Unreleased) +## 1.0.0 (Unreleased) +This Azure DevCenter library release uses the 2023-04-01 GA API. ### Features Added +- Added models and models serialization for each Dev Center concept +- Added methods in the clients returning the serialized model, not only BinaryData + ### Breaking Changes +- Renamed `AzureDeveloperDevCenterClientOptions` back to `DevCenterClientOptions` + ### Bugs Fixed ### Other Changes diff --git a/sdk/devcenter/Azure.Developer.DevCenter/README.md b/sdk/devcenter/Azure.Developer.DevCenter/README.md index 5c237c895d71..3e833763c658 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/README.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/README.md @@ -52,6 +52,13 @@ var devBoxesClient = new DevBoxesClient(endpoint, credential); var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); ``` +Alternatively use `DevCenterClient` to create `DevBoxesClient` and `DeploymentEnvironmentsClient` sharing same endpoint and credential across clients. + +```C# Snippet:Azure_DevCenter_CreateClientsFromDevCenterClient_Scenario +devBoxesClient = devCenterClient.GetDevBoxesClient(); +environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient(); +``` + ### Thread safety We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. @@ -76,12 +83,13 @@ You can familiarize yourself with different APIs using [Samples](https://github. `DevCenterClient` allows you to list projects and retrieve projects by their name. ```C# Snippet:Azure_DevCenter_GetProjects_Scenario -string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetProjectName = result.GetProperty("name").ToString(); -} +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); +var devCenterClient = new DevCenterClient(endpoint, credential); + +List projects = await devCenterClient.GetProjectsAsync().ToEnumerableAsync(); +var projectName = projects.FirstOrDefault().Name; ``` ### List available Dev Box Pools @@ -89,12 +97,12 @@ await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, n Interaction with DevBox pools is facilitated through the `DevBoxesClient`. Pools can be listed for a specific project or fetched individually. ```C# Snippet:Azure_DevCenter_GetPools_Scenario -string targetPoolName = null; -await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetPoolName = result.GetProperty("name").ToString(); -} +// Create DevBox-es client from existing DevCenter client +var devBoxesClient = devCenterClient.GetDevBoxesClient(); + +// Grab a pool +List pools = await devBoxesClient.GetPoolsAsync(projectName).ToEnumerableAsync(); +var poolName = pools.FirstOrDefault().Name; ``` ### Provision a Dev Box @@ -102,21 +110,17 @@ await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName To create a new DevBox, provide the pool name in the content and specify the desired DevBox name. Upon successful execution of this operation, a DevBox should appear in the portal. ```C# Snippet:Azure_DevCenter_CreateDevBox_Scenario -var content = new -{ - poolName = targetPoolName, -}; +var devBoxName = "MyDevBox"; +var devBox = new DevBox(devBoxName, poolName); -Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( +Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( WaitUntil.Completed, - targetProjectName, + projectName, "me", - "MyDevBox", - RequestContent.Create(content)); + devBox); -BinaryData devBoxData = await devBoxCreateOperation.WaitForCompletionAsync(); -JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).RootElement; -Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetProperty("provisioningState")}."); +devBox = await devBoxCreateOperation.WaitForCompletionAsync(); +Console.WriteLine($"Completed provisioning for dev box with status {devBox.ProvisioningState}."); ``` ### Connect to your Dev Box @@ -124,13 +128,12 @@ Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetPr Once a DevBox is provisioned, you can connect to it using an RDP connection string. Below is a sample code that demonstrates how to retrieve it. ```C# Snippet:Azure_DevCenter_ConnectToDevBox_Scenario -Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( - targetProjectName, +RemoteConnection remoteConnection = await devBoxesClient.GetRemoteConnectionAsync( + projectName, "me", - "MyDevBox", - null); -JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; -Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); + devBoxName); + +Console.WriteLine($"Connect using web URL {remoteConnection.WebUri}."); ``` ### Delete the Dev Box @@ -140,9 +143,9 @@ Deleting a DevBox is easy. It's much faster operation than creating a new DevBox ```C# Snippet:Azure_DevCenter_DeleteDevBox_Scenario Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( WaitUntil.Completed, - targetProjectName, + projectName, "me", - "MyDevBox"); + devBoxName); await devBoxDeleteOperation.WaitForCompletionResponseAsync(); Console.WriteLine($"Completed dev box deletion."); ``` @@ -152,13 +155,18 @@ Console.WriteLine($"Completed dev box deletion."); `DeploymentEnvironmentsClient` can be used to issue a request to get all catalogs in a project. ```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario -string catalogName = null; +// Create deployment environments client from existing DevCenter client +var environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient(); -await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName, null, null)) +//List all catalogs and grab the first one +//Using foreach, but could also use a List +string catalogName = default; +await foreach (DevCenterCatalog catalog in environmentsClient.GetCatalogsAsync(projectName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - catalogName = result.GetProperty("name").ToString(); + catalogName = catalog.Name; + break; } +Console.WriteLine($"Using catalog {catalogName}"); ``` ## Get all environment definitions in a project for a catalog @@ -166,12 +174,14 @@ await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectNam Environment definitions are a part of the catalog associated with your project. If you don't see the expected environment definitions in the results, please ensure that you have pushed your changes to the catalog repository and synchronized the catalog. ```C# Snippet:Azure_DevCenter_GetEnvironmentDefinitionsFromCatalog_Scenario -string environmentDefinitionName = null; -await foreach (BinaryData data in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName, maxCount: 1, context: new())) +//List all environment definition for a catalog and grab the first one +string environmentDefinitionName = default; +await foreach (EnvironmentDefinition environmentDefinition in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentDefinitionName = result.GetProperty("name").ToString(); + environmentDefinitionName = environmentDefinition.Name; + break; } +Console.WriteLine($"Using environment definition {environmentDefinitionName}"); ``` ## Get all environment types in a project @@ -179,12 +189,14 @@ await foreach (BinaryData data in environmentsClient.GetEnvironmentDefinitionsBy Issue a request to get all environment types in a project. ```C# Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario -string environmentTypeName = null; -await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName, null, null)) +//List all environment types and grab the first one +string environmentTypeName = default; +await foreach (DevCenterEnvironmentType environmentType in environmentsClient.GetEnvironmentTypesAsync(projectName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentTypeName = result.GetProperty("name").ToString(); + environmentTypeName = environmentType.Name; + break; } +Console.WriteLine($"Using environment type {environmentTypeName}"); ``` ## Create an environment @@ -192,24 +204,23 @@ await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(pr Issue a request to create an environment using a specific definition item and environment type. ```C# Snippet:Azure_DevCenter_CreateEnvironment_Scenario -var content = new -{ - catalogName = catalogName, - environmentType = environmentTypeName, - environmentDefinitionName = environmentDefinitionName, -}; +var requestEnvironment = new DevCenterEnvironment +( + "DevEnvironment", + environmentTypeName, + catalogName, + environmentDefinitionName +); // Deploy the environment -Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( +Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( WaitUntil.Completed, projectName, "me", - "DevEnvironment", - RequestContent.Create(content)); + requestEnvironment); -BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync(); -JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement; -Console.WriteLine($"Completed provisioning for environment with status {environment.GetProperty("provisioningState")}."); +DevCenterEnvironment environment = await environmentCreateOperation.WaitForCompletionAsync(); +Console.WriteLine($"Completed provisioning for environment with status {environment.ProvisioningState}."); ``` ## Delete an environment diff --git a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs index 4dd1e30e6925..e4a45c551c81 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs @@ -1,78 +1,118 @@ namespace Azure.Developer.DevCenter { - public partial class AzureDeveloperDevCenterClientOptions : Azure.Core.ClientOptions - { - public AzureDeveloperDevCenterClientOptions(Azure.Developer.DevCenter.AzureDeveloperDevCenterClientOptions.ServiceVersion version = Azure.Developer.DevCenter.AzureDeveloperDevCenterClientOptions.ServiceVersion.V2023_04_01) { } - public enum ServiceVersion - { - V2023_04_01 = 1, - } - } public partial class DeploymentEnvironmentsClient { protected DeploymentEnvironmentsClient() { } public DeploymentEnvironmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } - public DeploymentEnvironmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.AzureDeveloperDevCenterClientOptions options) { } + public DeploymentEnvironmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.DevCenterClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation CreateOrUpdateEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, Azure.Developer.DevCenter.Models.DevCenterEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation CreateOrUpdateEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, Azure.Developer.DevCenter.Models.DevCenterEnvironment environment, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Operation DeleteEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Pageable GetAllEnvironments(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetAllEnvironmentsAsync(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetAllEnvironments(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetAllEnvironments(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllEnvironmentsAsync(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetAllEnvironmentsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetCatalog(string projectName, string catalogName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetCatalog(string projectName, string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetCatalogAsync(string projectName, string catalogName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetCatalogs(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetCatalogsAsync(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetCatalogAsync(string projectName, string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetCatalogs(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetCatalogs(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetCatalogsAsync(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetCatalogsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetEnvironment(string projectName, string userId, string environmentName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetEnvironment(string projectName, string userId, string environmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetEnvironmentAsync(string projectName, string userId, string environmentName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetEnvironmentAsync(string projectName, string userId, string environmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetEnvironmentDefinition(string projectName, string catalogName, string definitionName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetEnvironmentDefinition(string projectName, string catalogName, string definitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetEnvironmentDefinitionAsync(string projectName, string catalogName, string definitionName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironmentDefinitions(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironments(string projectName, string userId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentsAsync(string projectName, string userId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironmentTypes(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentTypesAsync(string projectName, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetEnvironmentDefinitionAsync(string projectName, string catalogName, string definitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitions(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitions(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEnvironments(string projectName, string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetEnvironments(string projectName, string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentsAsync(string projectName, string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentsAsync(string projectName, string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetEnvironmentTypes(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetEnvironmentTypes(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentTypesAsync(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentTypesAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class DevBoxesClient { protected DevBoxesClient() { } public DevBoxesClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } - public DevBoxesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.AzureDeveloperDevCenterClientOptions options) { } + public DevBoxesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.DevCenterClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation CreateDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, Azure.Developer.DevCenter.Models.DevBox devBox, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation CreateDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, Azure.Developer.DevCenter.Models.DevBox devBox, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response DelayAction(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } + public virtual Azure.Response DelayAction(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset delayUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset delayUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable DelayAllActions(string projectName, string userId, string devBoxName, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable DelayAllActions(string projectName, string userId, string devBoxName, System.DateTimeOffset delayUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, System.DateTimeOffset delayUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation DeleteDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Pageable GetAllDevBoxes(string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetAllDevBoxesAsync(string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetAllDevBoxesByUser(string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetAllDevBoxesByUserAsync(string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetAllDevBoxes(Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetAllDevBoxes(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesAsync(Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAllDevBoxesByUser(string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetAllDevBoxesByUser(string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesByUserAsync(string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesByUserAsync(string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDevBox(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetDevBox(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetDevBoxAction(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetDevBoxAction(string projectName, string userId, string devBoxName, string actionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDevBoxActionAsync(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevBoxActionAsync(string projectName, string userId, string devBoxName, string actionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDevBoxActions(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetDevBoxActions(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDevBoxActionsAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetDevBoxActionsAsync(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetDevBoxAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetDevBoxes(string projectName, string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetDevBoxesAsync(string projectName, string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetDevBoxAsync(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDevBoxes(string projectName, string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetDevBoxes(string projectName, string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDevBoxesAsync(string projectName, string userId, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetDevBoxesAsync(string projectName, string userId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPool(string projectName, string poolName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetPool(string projectName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetPoolAsync(string projectName, string poolName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetPools(string projectName, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetPoolsAsync(string projectName, string filter, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetPoolAsync(string projectName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPools(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetPools(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPoolsAsync(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetPoolsAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetRemoteConnection(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetRemoteConnection(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetRemoteConnectionAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetRemoteConnectionAsync(string projectName, string userId, string devBoxName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetSchedule(string projectName, string poolName, string scheduleName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetSchedule(string projectName, string poolName, string scheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetScheduleAsync(string projectName, string poolName, string scheduleName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSchedules(string projectName, string poolName, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSchedulesAsync(string projectName, string poolName, string filter, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetScheduleAsync(string projectName, string poolName, string scheduleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSchedules(string projectName, string poolName, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetSchedules(string projectName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSchedulesAsync(string projectName, string poolName, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetSchedulesAsync(string projectName, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Operation RestartDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task RestartDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response SkipAction(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } @@ -86,23 +126,628 @@ public partial class DevCenterClient { protected DevCenterClient() { } public DevCenterClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } - public DevCenterClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.AzureDeveloperDevCenterClientOptions options) { } + public DevCenterClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.DevCenterClientOptions options) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Developer.DevCenter.DeploymentEnvironmentsClient GetDeploymentEnvironmentsClient() { throw null; } + public virtual Azure.Developer.DevCenter.DevBoxesClient GetDevBoxesClient() { throw null; } public virtual Azure.Response GetProject(string projectName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetProject(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task GetProjectAsync(string projectName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetProjects(string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetProjectsAsync(string filter, int? maxCount, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetProjectAsync(string projectName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetProjects(Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetProjects(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DevCenterClientOptions : Azure.Core.ClientOptions + { + public DevCenterClientOptions(Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion version = Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion.V2023_04_01) { } + public enum ServiceVersion + { + V2023_04_01 = 1, + } + } +} +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBox : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DevBox(string name, string poolName) { } + public string ActionState { get { throw null; } } + public System.DateTimeOffset? CreatedTime { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxHardwareProfile HardwareProfile { get { throw null; } } + public Azure.Developer.DevCenter.Models.HibernateSupport? HibernateSupport { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxImageReference ImageReference { get { throw null; } } + public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } set { } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxOSType? OSType { get { throw null; } } + public string PoolName { get { throw null; } set { } } + public Azure.Developer.DevCenter.Models.PowerState? PowerState { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxStorageProfile StorageProfile { get { throw null; } } + public System.Guid? UniqueId { get { throw null; } } + public System.Guid? UserId { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBox System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBox System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevBoxAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxAction() { } + public Azure.Developer.DevCenter.Models.DevBoxActionType ActionType { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxNextAction NextAction { get { throw null; } } + public string SourceId { get { throw null; } } + public System.DateTimeOffset? SuspendedUntil { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevBoxActionDelayResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxActionDelayResult() { } + public Azure.Developer.DevCenter.Models.DevBoxAction Action { get { throw null; } } + public string ActionName { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus DelayStatus { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxActionDelayResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxActionDelayResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevBoxActionDelayStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevBoxActionDelayStatus(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus Failed { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus Succeeded { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus left, Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus left, Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevBoxActionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevBoxActionType(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxActionType Stop { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.DevBoxActionType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.DevBoxActionType left, Azure.Developer.DevCenter.Models.DevBoxActionType right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.DevBoxActionType (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.DevBoxActionType left, Azure.Developer.DevCenter.Models.DevBoxActionType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DevBoxHardwareProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxHardwareProfile() { } + public int? MemoryGB { get { throw null; } } + public Azure.Developer.DevCenter.Models.SkuName? SkuName { get { throw null; } } + public int? VCPUs { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxHardwareProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxHardwareProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevBoxImageReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxImageReference() { } + public string Name { get { throw null; } } + public string OperatingSystem { get { throw null; } } + public string OSBuildNumber { get { throw null; } } + public System.DateTimeOffset? PublishedDate { get { throw null; } } + public string Version { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxImageReference System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxImageReference System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevBoxNextAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxNextAction() { } + public System.DateTimeOffset ScheduledTime { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxNextAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxNextAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevBoxOSType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevBoxOSType(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxOSType Windows { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.DevBoxOSType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.DevBoxOSType left, Azure.Developer.DevCenter.Models.DevBoxOSType right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.DevBoxOSType (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.DevBoxOSType left, Azure.Developer.DevCenter.Models.DevBoxOSType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DevBoxPool : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxPool() { } + public Azure.Developer.DevCenter.Models.DevBoxHardwareProfile HardwareProfile { get { throw null; } } + public Azure.Developer.DevCenter.Models.PoolHealthStatus HealthStatus { get { throw null; } } + public Azure.Developer.DevCenter.Models.HibernateSupport? HibernateSupport { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxImageReference ImageReference { get { throw null; } } + public Azure.Developer.DevCenter.Models.LocalAdministratorStatus? LocalAdministratorStatus { get { throw null; } } + public Azure.Core.AzureLocation Location { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxOSType? OSType { get { throw null; } } + public Azure.Developer.DevCenter.Models.StopOnDisconnectConfiguration StopOnDisconnect { get { throw null; } } + public Azure.Developer.DevCenter.Models.DevBoxStorageProfile StorageProfile { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxPool System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxPool System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevBoxProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevBoxProvisioningState(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Canceled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Creating { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Deleting { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Failed { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState InGracePeriod { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState NotProvisioned { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState ProvisionedWithWarning { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Provisioning { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Starting { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Stopping { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Succeeded { get { throw null; } } + public static Azure.Developer.DevCenter.Models.DevBoxProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.DevBoxProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.DevBoxProvisioningState left, Azure.Developer.DevCenter.Models.DevBoxProvisioningState right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.DevBoxProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.DevBoxProvisioningState left, Azure.Developer.DevCenter.Models.DevBoxProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DevBoxSchedule : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxSchedule() { } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.ScheduleFrequency ScheduleFrequency { get { throw null; } } + public Azure.Developer.DevCenter.Models.ScheduleType ScheduleType { get { throw null; } } + public string Time { get { throw null; } } + public string TimeZone { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxSchedule System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxSchedule System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevBoxStorageProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevBoxStorageProfile() { } + public Azure.Developer.DevCenter.Models.OSDisk OSDisk { get { throw null; } } + Azure.Developer.DevCenter.Models.DevBoxStorageProfile System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevBoxStorageProfile System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevCenterCatalog : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevCenterCatalog() { } + public string Name { get { throw null; } } + Azure.Developer.DevCenter.Models.DevCenterCatalog System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevCenterCatalog System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevCenterEnvironment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DevCenterEnvironment(string environmentName, string environmentTypeName, string catalogName, string environmentDefinitionName) { } + public string CatalogName { get { throw null; } set { } } + public string EnvironmentDefinitionName { get { throw null; } set { } } + public string EnvironmentTypeName { get { throw null; } set { } } + public Azure.ResponseError Error { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IDictionary Parameters { get { throw null; } } + public Azure.Developer.DevCenter.Models.EnvironmentProvisioningState? ProvisioningState { get { throw null; } } + public Azure.Core.ResourceIdentifier ResourceGroupId { get { throw null; } } + public System.Guid? UserId { get { throw null; } } + Azure.Developer.DevCenter.Models.DevCenterEnvironment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevCenterEnvironment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DevCenterEnvironmentType : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevCenterEnvironmentType() { } + public Azure.Core.ResourceIdentifier DeploymentTargetId { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.EnvironmentTypeStatus Status { get { throw null; } } + Azure.Developer.DevCenter.Models.DevCenterEnvironmentType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevCenterEnvironmentType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class DevCenterModelFactory + { + public static Azure.Developer.DevCenter.Models.DevBox DevBox(string name = null, string projectName = null, string poolName = null, Azure.Developer.DevCenter.Models.HibernateSupport? hibernateSupport = default(Azure.Developer.DevCenter.Models.HibernateSupport?), Azure.Developer.DevCenter.Models.DevBoxProvisioningState? provisioningState = default(Azure.Developer.DevCenter.Models.DevBoxProvisioningState?), string actionState = null, Azure.Developer.DevCenter.Models.PowerState? powerState = default(Azure.Developer.DevCenter.Models.PowerState?), System.Guid? uniqueId = default(System.Guid?), Azure.ResponseError error = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Developer.DevCenter.Models.DevBoxOSType? osType = default(Azure.Developer.DevCenter.Models.DevBoxOSType?), System.Guid? userId = default(System.Guid?), Azure.Developer.DevCenter.Models.DevBoxHardwareProfile hardwareProfile = null, Azure.Developer.DevCenter.Models.DevBoxStorageProfile storageProfile = null, Azure.Developer.DevCenter.Models.DevBoxImageReference imageReference = null, System.DateTimeOffset? createdTime = default(System.DateTimeOffset?), Azure.Developer.DevCenter.Models.LocalAdministratorStatus? localAdministratorStatus = default(Azure.Developer.DevCenter.Models.LocalAdministratorStatus?)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxAction DevBoxAction(string name = null, Azure.Developer.DevCenter.Models.DevBoxActionType actionType = default(Azure.Developer.DevCenter.Models.DevBoxActionType), string sourceId = null, System.DateTimeOffset? suspendedUntil = default(System.DateTimeOffset?), Azure.Developer.DevCenter.Models.DevBoxNextAction nextAction = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxActionDelayResult DevBoxActionDelayResult(string actionName = null, Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus delayStatus = default(Azure.Developer.DevCenter.Models.DevBoxActionDelayStatus), Azure.Developer.DevCenter.Models.DevBoxAction action = null, Azure.ResponseError error = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxHardwareProfile DevBoxHardwareProfile(Azure.Developer.DevCenter.Models.SkuName? skuName = default(Azure.Developer.DevCenter.Models.SkuName?), int? vcpUs = default(int?), int? memoryGB = default(int?)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxImageReference DevBoxImageReference(string name = null, string version = null, string operatingSystem = null, string osBuildNumber = null, System.DateTimeOffset? publishedDate = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxNextAction DevBoxNextAction(System.DateTimeOffset scheduledTime = default(System.DateTimeOffset)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxPool DevBoxPool(string name = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.Developer.DevCenter.Models.DevBoxOSType? osType = default(Azure.Developer.DevCenter.Models.DevBoxOSType?), Azure.Developer.DevCenter.Models.DevBoxHardwareProfile hardwareProfile = null, Azure.Developer.DevCenter.Models.HibernateSupport? hibernateSupport = default(Azure.Developer.DevCenter.Models.HibernateSupport?), Azure.Developer.DevCenter.Models.DevBoxStorageProfile storageProfile = null, Azure.Developer.DevCenter.Models.DevBoxImageReference imageReference = null, Azure.Developer.DevCenter.Models.LocalAdministratorStatus? localAdministratorStatus = default(Azure.Developer.DevCenter.Models.LocalAdministratorStatus?), Azure.Developer.DevCenter.Models.StopOnDisconnectConfiguration stopOnDisconnect = null, Azure.Developer.DevCenter.Models.PoolHealthStatus healthStatus = default(Azure.Developer.DevCenter.Models.PoolHealthStatus)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxSchedule DevBoxSchedule(string name = null, Azure.Developer.DevCenter.Models.ScheduleType scheduleType = default(Azure.Developer.DevCenter.Models.ScheduleType), Azure.Developer.DevCenter.Models.ScheduleFrequency scheduleFrequency = default(Azure.Developer.DevCenter.Models.ScheduleFrequency), string time = null, string timeZone = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevBoxStorageProfile DevBoxStorageProfile(Azure.Developer.DevCenter.Models.OSDisk osDisk = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevCenterCatalog DevCenterCatalog(string name = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevCenterEnvironment DevCenterEnvironment(System.Collections.Generic.IDictionary parameters = null, string name = null, string environmentTypeName = null, System.Guid? userId = default(System.Guid?), Azure.Developer.DevCenter.Models.EnvironmentProvisioningState? provisioningState = default(Azure.Developer.DevCenter.Models.EnvironmentProvisioningState?), Azure.Core.ResourceIdentifier resourceGroupId = null, string catalogName = null, string environmentDefinitionName = null, Azure.ResponseError error = null) { throw null; } + public static Azure.Developer.DevCenter.Models.DevCenterEnvironmentType DevCenterEnvironmentType(string name = null, Azure.Core.ResourceIdentifier deploymentTargetId = null, Azure.Developer.DevCenter.Models.EnvironmentTypeStatus status = default(Azure.Developer.DevCenter.Models.EnvironmentTypeStatus)) { throw null; } + public static Azure.Developer.DevCenter.Models.DevCenterProject DevCenterProject(string name = null, string description = null, int? maxDevBoxesPerUser = default(int?)) { throw null; } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinition EnvironmentDefinition(string id = null, string name = null, string catalogName = null, string description = null, System.Collections.Generic.IEnumerable parameters = null, string parametersSchema = null, string templatePath = null) { throw null; } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameter EnvironmentDefinitionParameter(string id = null, string name = null, string description = null, string defaultValue = null, Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType parameterType = default(Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType), bool? readOnly = default(bool?), bool required = false, System.Collections.Generic.IEnumerable allowed = null) { throw null; } + public static Azure.Developer.DevCenter.Models.OSDisk OSDisk(int? diskSizeGB = default(int?)) { throw null; } + public static Azure.Developer.DevCenter.Models.RemoteConnection RemoteConnection(System.Uri webUri = null, System.Uri rdpConnectionUri = null) { throw null; } + public static Azure.Developer.DevCenter.Models.StopOnDisconnectConfiguration StopOnDisconnectConfiguration(Azure.Developer.DevCenter.Models.StopOnDisconnectStatus status = default(Azure.Developer.DevCenter.Models.StopOnDisconnectStatus), int? gracePeriodMinutes = default(int?)) { throw null; } + } + public partial class DevCenterProject : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DevCenterProject() { } + public string Description { get { throw null; } } + public int? MaxDevBoxesPerUser { get { throw null; } } + public string Name { get { throw null; } } + Azure.Developer.DevCenter.Models.DevCenterProject System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.DevCenterProject System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EnvironmentDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EnvironmentDefinition() { } + public string CatalogName { get { throw null; } } + public string Description { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Parameters { get { throw null; } } + public string ParametersSchema { get { throw null; } } + public string TemplatePath { get { throw null; } } + Azure.Developer.DevCenter.Models.EnvironmentDefinition System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.EnvironmentDefinition System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EnvironmentDefinitionParameter : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EnvironmentDefinitionParameter() { } + public System.Collections.Generic.IReadOnlyList Allowed { get { throw null; } } + public string DefaultValue { get { throw null; } } + public string Description { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType ParameterType { get { throw null; } } + public bool? ReadOnly { get { throw null; } } + public bool Required { get { throw null; } } + Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameter System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameter System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EnvironmentDefinitionParameterType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EnvironmentDefinitionParameterType(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType Array { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType Boolean { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType Integer { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType Number { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType Object { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType String { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType left, Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType left, Azure.Developer.DevCenter.Models.EnvironmentDefinitionParameterType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EnvironmentProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EnvironmentProvisioningState(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Accepted { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Canceled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Creating { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Deleting { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Failed { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState MovingResources { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Preparing { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Running { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState StorageProvisioningFailed { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Succeeded { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Syncing { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState TransientFailure { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.EnvironmentProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.EnvironmentProvisioningState left, Azure.Developer.DevCenter.Models.EnvironmentProvisioningState right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.EnvironmentProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.EnvironmentProvisioningState left, Azure.Developer.DevCenter.Models.EnvironmentProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EnvironmentTypeStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EnvironmentTypeStatus(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.EnvironmentTypeStatus Disabled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.EnvironmentTypeStatus Enabled { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.EnvironmentTypeStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.EnvironmentTypeStatus left, Azure.Developer.DevCenter.Models.EnvironmentTypeStatus right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.EnvironmentTypeStatus (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.EnvironmentTypeStatus left, Azure.Developer.DevCenter.Models.EnvironmentTypeStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HibernateSupport : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HibernateSupport(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.HibernateSupport Disabled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.HibernateSupport Enabled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.HibernateSupport OsUnsupported { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.HibernateSupport other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.HibernateSupport left, Azure.Developer.DevCenter.Models.HibernateSupport right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.HibernateSupport (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.HibernateSupport left, Azure.Developer.DevCenter.Models.HibernateSupport right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LocalAdministratorStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LocalAdministratorStatus(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.LocalAdministratorStatus Disabled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.LocalAdministratorStatus Enabled { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.LocalAdministratorStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.LocalAdministratorStatus left, Azure.Developer.DevCenter.Models.LocalAdministratorStatus right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.LocalAdministratorStatus (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.LocalAdministratorStatus left, Azure.Developer.DevCenter.Models.LocalAdministratorStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OSDisk : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OSDisk() { } + public int? DiskSizeGB { get { throw null; } } + Azure.Developer.DevCenter.Models.OSDisk System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.OSDisk System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PoolHealthStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PoolHealthStatus(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.PoolHealthStatus Healthy { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PoolHealthStatus Pending { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PoolHealthStatus Unhealthy { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PoolHealthStatus Unknown { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PoolHealthStatus Warning { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.PoolHealthStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.PoolHealthStatus left, Azure.Developer.DevCenter.Models.PoolHealthStatus right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.PoolHealthStatus (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.PoolHealthStatus left, Azure.Developer.DevCenter.Models.PoolHealthStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PowerState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PowerState(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.PowerState Deallocated { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PowerState Hibernated { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PowerState PoweredOff { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PowerState Running { get { throw null; } } + public static Azure.Developer.DevCenter.Models.PowerState Unknown { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.PowerState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.PowerState left, Azure.Developer.DevCenter.Models.PowerState right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.PowerState (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.PowerState left, Azure.Developer.DevCenter.Models.PowerState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RemoteConnection : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RemoteConnection() { } + public System.Uri RdpConnectionUri { get { throw null; } } + public System.Uri WebUri { get { throw null; } } + Azure.Developer.DevCenter.Models.RemoteConnection System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.RemoteConnection System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScheduleFrequency : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScheduleFrequency(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.ScheduleFrequency Daily { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.ScheduleFrequency other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.ScheduleFrequency left, Azure.Developer.DevCenter.Models.ScheduleFrequency right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.ScheduleFrequency (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.ScheduleFrequency left, Azure.Developer.DevCenter.Models.ScheduleFrequency right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScheduleType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScheduleType(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.ScheduleType StopDevBox { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.ScheduleType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.ScheduleType left, Azure.Developer.DevCenter.Models.ScheduleType right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.ScheduleType (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.ScheduleType left, Azure.Developer.DevCenter.Models.ScheduleType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SkuName(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA16c64gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA16c64gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA16c64gb256ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA16c64gb512ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA32c128gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA32c128gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA32c128gb512ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA8c32gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA8c32gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA8c32gb256ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralA8c32gb512ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI16c64gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI16c64gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI16c64gb256ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI16c64gb512ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI32c128gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI32c128gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI32c128gb512ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI8c32gb1024ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI8c32gb2048ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI8c32gb256ssdV2 { get { throw null; } } + public static Azure.Developer.DevCenter.Models.SkuName GeneralI8c32gb512ssdV2 { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.SkuName other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.SkuName left, Azure.Developer.DevCenter.Models.SkuName right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.SkuName (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.SkuName left, Azure.Developer.DevCenter.Models.SkuName right) { throw null; } + public override string ToString() { throw null; } + } + public partial class StopOnDisconnectConfiguration : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal StopOnDisconnectConfiguration() { } + public int? GracePeriodMinutes { get { throw null; } } + public Azure.Developer.DevCenter.Models.StopOnDisconnectStatus Status { get { throw null; } } + Azure.Developer.DevCenter.Models.StopOnDisconnectConfiguration System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Developer.DevCenter.Models.StopOnDisconnectConfiguration System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StopOnDisconnectStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StopOnDisconnectStatus(string value) { throw null; } + public static Azure.Developer.DevCenter.Models.StopOnDisconnectStatus Disabled { get { throw null; } } + public static Azure.Developer.DevCenter.Models.StopOnDisconnectStatus Enabled { get { throw null; } } + public bool Equals(Azure.Developer.DevCenter.Models.StopOnDisconnectStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Developer.DevCenter.Models.StopOnDisconnectStatus left, Azure.Developer.DevCenter.Models.StopOnDisconnectStatus right) { throw null; } + public static implicit operator Azure.Developer.DevCenter.Models.StopOnDisconnectStatus (string value) { throw null; } + public static bool operator !=(Azure.Developer.DevCenter.Models.StopOnDisconnectStatus left, Azure.Developer.DevCenter.Models.StopOnDisconnectStatus right) { throw null; } + public override string ToString() { throw null; } } } namespace Microsoft.Extensions.Azure { - public static partial class DeveloperDevCenterClientBuilderExtensions - { - public static Azure.Core.Extensions.IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddDevCenterClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddDevCenterClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static partial class DevCenterClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddDevCenterClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddDevCenterClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/assets.json b/sdk/devcenter/Azure.Developer.DevCenter/assets.json index d20aecaa0560..496d3d64c9ef 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/assets.json +++ b/sdk/devcenter/Azure.Developer.DevCenter/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/devcenter/Azure.Developer.DevCenter", - "Tag": "net/devcenter/Azure.Developer.DevCenter_06b6e86958" + "Tag": "net/devcenter/Azure.Developer.DevCenter_95190a8afc" } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md index 3c6fc1374e96..bd8cb08afa25 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md @@ -10,7 +10,11 @@ description: Samples for the Azure.Developer.DevCenter client library. --- # Azure.Developer.DevCenter Samples - -* [Create and delete a Dev Box](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md) -* [Create and delete an Environment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md) +* [Create Dev Center Client and Get a Project](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample1_DevCenterClient_HelloWorldAsync.md) +* [Create Dev Boxes Client and Get a DevBox](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample2_DevBoxesClient_HelloWorldAsync.md) +* [Create Deployment Environment Client and Get an Environment](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample3_EnvironmentsClient_HelloWorldAsync.md) +* [Create, Connect and Delete a Dev Box](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample4_CreateDeleteDevBoxAsync.md) +* [Stop, Start and Restart a Dev Box](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample5_StopStartRestartDevBoxAsync.md) +* [Manipulate Dev Box Actions](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample6_GetDelaySkipDevBoxActionsAsync.md) +* [Deployment Environments Operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample7_CreateDeleteEnvironmentAsync.md) diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample1_DevCenterClient_HelloWorldAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample1_DevCenterClient_HelloWorldAsync.md new file mode 100644 index 000000000000..7dfb27809e0d --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample1_DevCenterClient_HelloWorldAsync.md @@ -0,0 +1,34 @@ +# Create Dev Center Client and Get a Project + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_BasicImport +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Create dev center client + +To get a project first instantiate the dev center client. + +```C# Snippet:Azure_DevCenter_CreateDevCenterClient +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); + +var devCenterClient = new DevCenterClient(endpoint, credential); +``` + +## Get a project in the dev center + +Using the `DevCenterClient` issue a request to get a specific project. + +```C# Snippet:Azure_DevCenter_GetProjectAsync +DevCenterProject project = await devCenterClient.GetProjectAsync("MyProject"); +Console.WriteLine(project.Name); +``` + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample2_DevBoxesClient_HelloWorldAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample2_DevBoxesClient_HelloWorldAsync.md new file mode 100644 index 000000000000..09ef509381a7 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample2_DevBoxesClient_HelloWorldAsync.md @@ -0,0 +1,34 @@ +# Create Dev Boxes Client and Get a DevBox + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_BasicImport +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Create dev boxes client + +To manipulate any of the dev boxes operations use the `DevBoxesClient`. + +```C# Snippet:Azure_DevCenter_CreateDevBoxesClient +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); + +var devBoxesClient = new DevBoxesClient(endpoint, credential); +``` + +## Get a dev box + +Using the `DevBoxesClient` issue a request to get a dev box. + +```C# Snippet:Azure_DevCenter_GetDevBoxAsync +DevBox devBox = await devBoxesClient.GetDevBoxAsync("MyProject", "me", "MyDevBox"); +Console.WriteLine($"The dev box {devBox.Name} is located in the {devBox.Location} region."); +``` + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample3_EnvironmentsClient_HelloWorldAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample3_EnvironmentsClient_HelloWorldAsync.md new file mode 100644 index 000000000000..fc30425c1a0c --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample3_EnvironmentsClient_HelloWorldAsync.md @@ -0,0 +1,34 @@ +# Create Deployment Environment Client and Get an Environment + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_BasicImport +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Create deployment environments client + +To manipulate any of the deployment environment operations use the `DeploymentEnvironmentsClient`. + +```C# Snippet:Azure_DevCenter_CreateDeploymentEnvironmentsClient +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); + +var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); +``` + +## Get a dev box + +Using the `DeploymentEnvironmentsClient` issue a request to get an environment. + +```C# Snippet:Azure_DevCenter_GetEnvironmentAsync +DevCenterEnvironment environment = await environmentsClient.GetEnvironmentAsync("MyProject", "me", "MyEnvironment"); +Console.WriteLine($"The environment {environment.Name} is in {environment.ProvisioningState} state"); +``` + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample4_CreateDeleteDevBoxAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample4_CreateDeleteDevBoxAsync.md new file mode 100644 index 000000000000..8ca3cf368473 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample4_CreateDeleteDevBoxAsync.md @@ -0,0 +1,87 @@ +# Create, Connect and Delete a Dev Box + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_LongImports +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Get all projects in a dev center + +Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. + +```C# Snippet:Azure_DevCenter_GetProjects_Scenario +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); +var devCenterClient = new DevCenterClient(endpoint, credential); + +List projects = await devCenterClient.GetProjectsAsync().ToEnumerableAsync(); +var projectName = projects.FirstOrDefault().Name; +``` + +## Get all pools in a project + +Create a `DevBoxesClient` and issue a request to get all pools in a project. + +```C# Snippet:Azure_DevCenter_GetPools_Scenario +// Create DevBox-es client from existing DevCenter client +var devBoxesClient = devCenterClient.GetDevBoxesClient(); + +// Grab a pool +List pools = await devBoxesClient.GetPoolsAsync(projectName).ToEnumerableAsync(); +var poolName = pools.FirstOrDefault().Name; +``` + +## Create a dev box + +Issue a request to create a dev box in a project using a specific pool. + +```C# Snippet:Azure_DevCenter_CreateDevBox_Scenario +var devBoxName = "MyDevBox"; +var devBox = new DevBox(devBoxName, poolName); + +Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( + WaitUntil.Completed, + projectName, + "me", + devBox); + +devBox = await devBoxCreateOperation.WaitForCompletionAsync(); +Console.WriteLine($"Completed provisioning for dev box with status {devBox.ProvisioningState}."); +``` + +## Connect to a dev box + +Once your dev box is created, issue a request to get URI for connecting to it via either web or desktop. + +```C# Snippet:Azure_DevCenter_ConnectToDevBox_Scenario +RemoteConnection remoteConnection = await devBoxesClient.GetRemoteConnectionAsync( + projectName, + "me", + devBoxName); + +Console.WriteLine($"Connect using web URL {remoteConnection.WebUri}."); +``` + +## Delete a dev box + +Issue a request to delete a dev box. + +```C# Snippet:Azure_DevCenter_DeleteDevBox_Scenario +Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( + WaitUntil.Completed, + projectName, + "me", + devBoxName); +await devBoxDeleteOperation.WaitForCompletionResponseAsync(); +Console.WriteLine($"Completed dev box deletion."); +``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample5_StopStartRestartDevBoxAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample5_StopStartRestartDevBoxAsync.md new file mode 100644 index 000000000000..90fc2a1fa7d6 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample5_StopStartRestartDevBoxAsync.md @@ -0,0 +1,77 @@ +# Stop, Start and Restart a Dev Box + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_BasicImport +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Get a dev box + +Create a `DevBoxesClient` and issue a request to get a dev box. + +```C# Snippet:Azure_DevCenter_GetDevBox_Scenario +// Create DevBox-es client +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); +var devBoxesClient = new DevBoxesClient(endpoint, credential); + +//Dev Box properties +var projectName = "MyProject"; +var devBoxName = "MyDevBox"; +var user = "me"; + +// Grab the dev box +DevBox devBox = await devBoxesClient.GetDevBoxAsync(projectName, user, devBoxName); +``` + +## Stop a dev box +Read the power state a dev box and stop it if the dev box is running. + +```C# Snippet:Azure_DevCenter_StopDevBox_Scenario +if (devBox.PowerState == PowerState.Running) +{ + //Stop the dev box + await devBoxesClient.StopDevBoxAsync( + WaitUntil.Completed, + projectName, + user, + devBoxName); + + Console.WriteLine($"Completed stopping the dev box."); +} +``` + +## Start a dev box + +```C# Snippet:Azure_DevCenter_StartDevBox_Scenario +//Start the dev box +Operation response = await devBoxesClient.StartDevBoxAsync( + WaitUntil.Started, + projectName, + user, + devBoxName); + +response.WaitForCompletionResponse(); +Console.WriteLine($"Completed starting the dev box."); +``` + +## Restart a dev box + + +```C# Snippet:Azure_DevCenter_RestartDevBox_Scenario +//Restart the dev box +await devBoxesClient.RestartDevBoxAsync( + WaitUntil.Completed, + projectName, + user, + devBoxName); + +Console.WriteLine($"Completed restarting the dev box."); +``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample6_GetDelaySkipDevBoxActionsAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample6_GetDelaySkipDevBoxActionsAsync.md new file mode 100644 index 000000000000..c3658944d790 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample6_GetDelaySkipDevBoxActionsAsync.md @@ -0,0 +1,103 @@ +# Manipulate Dev Box Actions + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Import the namespaces + +```C# Snippet:Azure_DevCenter_LongImports +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +``` + +## Get a dev box action + +Create a `DevBoxesClient` and issue a request to get the default schedule action of a dev box. + +```C# Snippet:Azure_DevCenter_GetDevBoxAction_Scenario +// Create DevBox-es client +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); +var devBoxesClient = new DevBoxesClient(endpoint, credential); + +//Dev Box properties +var projectName = "MyProject"; +var devBoxName = "MyDevBox"; +var user = "me"; + +//Get the default schedule action of a dev box +DevBoxAction action = await devBoxesClient.GetDevBoxActionAsync( + projectName, + user, + devBoxName, + "schedule-default"); +``` + +## Delay a dev box action + +Once knowing what is the action time, issue a request to delay the action. +```C# Snippet:Azure_DevCenter_DelayDevBoxAction_Scenario +//The time an action is scheduled to perform +DateTimeOffset actionTime = action.NextAction.ScheduledTime; + +//Delay an action by 10 min +DateTimeOffset delayUntil = actionTime.AddMinutes(10); +DevBoxAction delayedAction = await devBoxesClient.DelayActionAsync( + projectName, + user, + devBoxName, + action.Name, + delayUntil); + +Console.WriteLine($"Action {action.Name} was delayed until {delayedAction.NextAction.ScheduledTime}."); +``` + +## List all actions of a dev box +List all actions of a dev box and determine what is the time of the action most in the future. +```C# Snippet:Azure_DevCenter_GetDevBoxActions_Scenario +//List all actions for a dev box +List actions = await devBoxesClient.GetDevBoxActionsAsync(projectName, user, devBoxName).ToEnumerableAsync(); + +//Another way of getting a dev box action +action = actions.Where(x => x.Name == "schedule-default").FirstOrDefault(); +Console.WriteLine($"Action {action.Name} is now schedule to {action.ActionType} at {action.NextAction.ScheduledTime}."); + +//Get the time of the action most in the future +DateTimeOffset latestActionTime = actions.Max(x => x.NextAction.ScheduledTime); +``` + +## Delay all actions of a dev box +Issue a request to delay all actions of a dev box. Note that the delay of each action can succeed or fail independently. Use the `DevBoxActionDelayResult.DelayStatus` to see the status of each delay. +```C# Snippet:Azure_DevCenter_DelayAllActions_Scenario +//Delay all actions +DateTimeOffset delayAllActionsUntil = latestActionTime.AddMinutes(10); +await foreach (DevBoxActionDelayResult actionDelayResult in devBoxesClient.DelayAllActionsAsync(projectName, user, devBoxName, delayAllActionsUntil)) +{ + if (actionDelayResult.DelayStatus == DevBoxActionDelayStatus.Succeeded) + { + Console.WriteLine($"Action {actionDelayResult.ActionName} was successfully delayed until {actionDelayResult.Action.SuspendedUntil}"); + } + else + { + Console.WriteLine($"Action {actionDelayResult.ActionName} failed to delay"); + } +} +``` + +## Skip an action +Issue a request to skip an action of a dev box. +```C# Snippet:Azure_DevCenter_SkipAction_Scenario +//Skip the default schedule action +Response skipActionResponse = await devBoxesClient.SkipActionAsync( + projectName, + user, + devBoxName, + "schedule-default"); + +Console.WriteLine($"Skip action finished with status {skipActionResponse.Status}."); +``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample7_CreateDeleteEnvironmentAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample7_CreateDeleteEnvironmentAsync.md new file mode 100644 index 000000000000..9bac14edfdd6 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample7_CreateDeleteEnvironmentAsync.md @@ -0,0 +1,102 @@ +# Deployment Environments Operations + +To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. + +## Get all projects in a dev center + +Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. + +```C# Snippet:Azure_DevCenter_GetProjects_Scenario +string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; +var endpoint = new Uri(devCenterUri); +var credential = new DefaultAzureCredential(); +var devCenterClient = new DevCenterClient(endpoint, credential); + +List projects = await devCenterClient.GetProjectsAsync().ToEnumerableAsync(); +var projectName = projects.FirstOrDefault().Name; +``` + +## Get project catalogs + +Create an `EnvironmentsClient` and issue a request to get all catalogs in a project. + +```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario +// Create deployment environments client from existing DevCenter client +var environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient(); + +//List all catalogs and grab the first one +//Using foreach, but could also use a List +string catalogName = default; +await foreach (DevCenterCatalog catalog in environmentsClient.GetCatalogsAsync(projectName)) +{ + catalogName = catalog.Name; + break; +} +Console.WriteLine($"Using catalog {catalogName}"); +``` + +## Get all environment definitions in a project for a catalog + +```C# Snippet:Azure_DevCenter_GetEnvironmentDefinitionsFromCatalog_Scenario +//List all environment definition for a catalog and grab the first one +string environmentDefinitionName = default; +await foreach (EnvironmentDefinition environmentDefinition in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName)) +{ + environmentDefinitionName = environmentDefinition.Name; + break; +} +Console.WriteLine($"Using environment definition {environmentDefinitionName}"); +``` + +## Get all environment types in a project + +Issue a request to get all environment types in a project. + +```C# Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario +//List all environment types and grab the first one +string environmentTypeName = default; +await foreach (DevCenterEnvironmentType environmentType in environmentsClient.GetEnvironmentTypesAsync(projectName)) +{ + environmentTypeName = environmentType.Name; + break; +} +Console.WriteLine($"Using environment type {environmentTypeName}"); +``` + +## Create an environment + +Issue a request to create an environment using a specific definition item and environment type. + +```C# Snippet:Azure_DevCenter_CreateEnvironment_Scenario +var requestEnvironment = new DevCenterEnvironment +( + "DevEnvironment", + environmentTypeName, + catalogName, + environmentDefinitionName +); + +// Deploy the environment +Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( + WaitUntil.Completed, + projectName, + "me", + requestEnvironment); + +DevCenterEnvironment environment = await environmentCreateOperation.WaitForCompletionAsync(); +Console.WriteLine($"Completed provisioning for environment with status {environment.ProvisioningState}."); +``` + +## Delete an environment + +Issue a request to delete an environment. + +```C# Snippet:Azure_DevCenter_DeleteEnvironment_Scenario +Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync( + WaitUntil.Completed, + projectName, + "me", + "DevEnvironment"); +await environmentDeleteOperation.WaitForCompletionResponseAsync(); +Console.WriteLine($"Completed environment deletion."); +``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md deleted file mode 100644 index bf60e4be251a..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md +++ /dev/null @@ -1,79 +0,0 @@ -# Azure.Developer.DevCenter samples - Dev Boxes - -To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. - -## Get all projects in a dev center - -Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. - -```C# Snippet:Azure_DevCenter_GetProjects_Scenario -string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetProjectName = result.GetProperty("name").ToString(); -} -``` - -## Get all pools in a project - -Create a `DevBoxesClient` and issue a request to get all pools in a project. - -```C# Snippet:Azure_DevCenter_GetPools_Scenario -string targetPoolName = null; -await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName, null, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetPoolName = result.GetProperty("name").ToString(); -} -``` - -## Create a dev box - -Issue a request to create a dev box in a project using a specific pool. - -```C# Snippet:Azure_DevCenter_CreateDevBox_Scenario -var content = new -{ - poolName = targetPoolName, -}; - -Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( - WaitUntil.Completed, - targetProjectName, - "me", - "MyDevBox", - RequestContent.Create(content)); - -BinaryData devBoxData = await devBoxCreateOperation.WaitForCompletionAsync(); -JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).RootElement; -Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetProperty("provisioningState")}."); -``` - -## Connect to a dev box - -Once your dev box is created, issue a request to get URLs for connecting to it via either web or desktop. - -```C# Snippet:Azure_DevCenter_ConnectToDevBox_Scenario -Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( - targetProjectName, - "me", - "MyDevBox", - null); -JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; -Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); -``` - -## Delete a dev box - -Issue a request to delete a dev box. - -```C# Snippet:Azure_DevCenter_DeleteDevBox_Scenario -Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( - WaitUntil.Completed, - targetProjectName, - "me", - "MyDevBox"); -await devBoxDeleteOperation.WaitForCompletionResponseAsync(); -Console.WriteLine($"Completed dev box deletion."); -``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md deleted file mode 100644 index 7ab5cf44520a..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md +++ /dev/null @@ -1,93 +0,0 @@ -# Azure.Developer.DevCenter samples - Deployment Environments - -To use these samples, you'll first need to set up resources. See [getting started](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/devcenter/Azure.Developer.DevCenter/README.md#getting-started) for details. - -## Get all projects in a dev center - -Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. - -```C# Snippet:Azure_DevCenter_GetProjects_Scenario -string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetProjectName = result.GetProperty("name").ToString(); -} -``` - -## Get project catalogs - -Create an `EnvironmentsClient` and issue a request to get all catalogs in a project. - -```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario -string catalogName = null; - -await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - catalogName = result.GetProperty("name").ToString(); -} -``` - -## Get all environment definitions in a project for a catalog - -```C# Snippet:Azure_DevCenter_GetEnvironmentDefinitionsFromCatalog_Scenario -string environmentDefinitionName = null; -await foreach (BinaryData data in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName, maxCount: 1, context: new())) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentDefinitionName = result.GetProperty("name").ToString(); -} -``` - -## Get all environment types in a project - -Issue a request to get all environment types in a project. - -```C# Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario -string environmentTypeName = null; -await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName, null, null)) -{ - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentTypeName = result.GetProperty("name").ToString(); -} -``` - -## Create an environment - -Issue a request to create an environment using a specific definition item and environment type. - -```C# Snippet:Azure_DevCenter_CreateEnvironment_Scenario -var content = new -{ - catalogName = catalogName, - environmentType = environmentTypeName, - environmentDefinitionName = environmentDefinitionName, -}; - -// Deploy the environment -Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( - WaitUntil.Completed, - projectName, - "me", - "DevEnvironment", - RequestContent.Create(content)); - -BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync(); -JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement; -Console.WriteLine($"Completed provisioning for environment with status {environment.GetProperty("provisioningState")}."); -``` - -## Delete an environment - -Issue a request to delete an environment. - -```C# Snippet:Azure_DevCenter_DeleteEnvironment_Scenario -Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync( - WaitUntil.Completed, - projectName, - "me", - "DevEnvironment"); -await environmentDeleteOperation.WaitForCompletionResponseAsync(); -Console.WriteLine($"Completed environment deletion."); -``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj b/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj index 7fcd1dbca768..18cb7f400e6f 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Azure.Developer.DevCenter.csproj @@ -2,7 +2,7 @@ This is the DevCenter client library for developing .NET applications with rich experience. Azure SDK Code Generation DevCenter for Azure Data Plane - 1.0.0-beta.4 + 1.0.0 Azure DevCenter $(RequiredTargetFrameworks) true @@ -16,6 +16,7 @@ + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DeploymentEnvironmentsClient.cs new file mode 100644 index 000000000000..5c4f13128377 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DeploymentEnvironmentsClient.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.Developer.DevCenter.Models; + +namespace Azure.Developer.DevCenter +{ + [CodeGenSuppress("CreateOrUpdateEnvironmentAsync", typeof(WaitUntil), typeof(string), typeof(string), typeof(string), typeof(DevCenterEnvironment), typeof(CancellationToken))] + [CodeGenSuppress("CreateOrUpdateEnvironment", typeof(WaitUntil), typeof(string), typeof(string), typeof(string), typeof(DevCenterEnvironment), typeof(CancellationToken))] + public partial class DeploymentEnvironmentsClient + { + /// Creates or updates an environment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Represents an environment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrUpdateEnvironmentAsync(WaitUntil waitUntil, string projectName, string userId, DevCenterEnvironment environment, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNull(environment, nameof(environment)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = environment.ToRequestContent(); + Operation response = await CreateOrUpdateEnvironmentAsync(waitUntil, projectName, userId, environment.Name, content, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, DevCenterEnvironment.FromResponse, ClientDiagnostics, "DeploymentEnvironmentsClient.CreateOrUpdateEnvironment"); + } + + /// Creates or updates an environment. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Represents an environment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUntil, string projectName, string userId, DevCenterEnvironment environment, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNull(environment, nameof(environment)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = environment.ToRequestContent(); + Operation response = CreateOrUpdateEnvironment(waitUntil, projectName, userId, environment.Name, content, context); + return ProtocolOperationHelpers.Convert(response, DevCenterEnvironment.FromResponse, ClientDiagnostics, "DeploymentEnvironmentsClient.CreateOrUpdateEnvironment"); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBox.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBox.cs new file mode 100644 index 000000000000..ebe8965a9ce5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBox.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + [CodeGenSuppress("DevBox", typeof(string))] + public partial class DevBox + { + /// Initializes a new instance of . + /// Display name for the Dev Box. + /// The name of the Dev Box pool this machine belongs to. + /// or is null. + public DevBox(string name, string poolName) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(poolName, nameof(poolName)); + + Name = name; + PoolName = poolName; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBoxesClient.cs new file mode 100644 index 000000000000..ff391c755988 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevBoxesClient.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Developer.DevCenter.Models; + +namespace Azure.Developer.DevCenter +{ + [CodeGenSuppress("CreateDevBoxAsync", typeof(WaitUntil), typeof(string), typeof(string), typeof(string), typeof(DevBox), typeof(CancellationToken))] + [CodeGenSuppress("CreateDevBox", typeof(WaitUntil), typeof(string), typeof(string), typeof(string), typeof(DevBox), typeof(CancellationToken))] + public partial class DevBoxesClient + { + /// Creates or replaces a Dev Box. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DevCenter Project upon which to execute the operation. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Represents the body request of a Dev Box creation. Dev Box Pool name is required. Optionally set the owner of the Dev Box as local administrator. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, DevBox devBox, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBox.Name, nameof(devBox.Name)); + Argument.AssertNotNull(devBox, nameof(devBox)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = devBox.ToRequestContent(); + Operation response = await CreateDevBoxAsync(waitUntil, projectName, userId, devBox.Name, content, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, DevBox.FromResponse, ClientDiagnostics, "DevBoxesClient.CreateDevBox"); + } + + /// Creates or replaces a Dev Box. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DevCenter Project upon which to execute the operation. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Represents the body request of a Dev Box creation. Dev Box Pool name is required. Optionally set the owner of the Dev Box as local administrator. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Operation CreateDevBox(WaitUntil waitUntil, string projectName, string userId, DevBox devBox, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBox.Name, nameof(devBox.Name)); + Argument.AssertNotNull(devBox, nameof(devBox)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = devBox.ToRequestContent(); + Operation response = CreateDevBox(waitUntil, projectName, userId, devBox.Name, content, context); + return ProtocolOperationHelpers.Convert(response, DevBox.FromResponse, ClientDiagnostics, "DevBoxesClient.CreateDevBox"); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClient.cs new file mode 100644 index 000000000000..19c39fe6cf26 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClient.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Developer.DevCenter +{ + public partial class DevCenterClient + { + private readonly DevCenterClientOptions _options; + + /// Initializes a new instance of DevCenterClient. + /// The DevCenter-specific URI to operate on. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public DevCenterClient(Uri endpoint, TokenCredential credential, DevCenterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + _options = options ?? new DevCenterClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(_options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(_options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = _options.Version; + } + + /// Initializes a new instance of DevBoxesClient from DevCenterClient + public virtual DevBoxesClient GetDevBoxesClient() => new DevBoxesClient(_endpoint, _tokenCredential, _options); + + /// Initializes a new instance of DeploymentEnvironmentsClient from DevCenterClient + public virtual DeploymentEnvironmentsClient GetDeploymentEnvironmentsClient() => new DeploymentEnvironmentsClient(_endpoint, _tokenCredential, _options); + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientBuilderExtensions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientBuilderExtensions.cs new file mode 100644 index 000000000000..eaaea8e3030e --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientBuilderExtensions.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Microsoft.Extensions.Azure +{ + [CodeGenClient("DeveloperDevCenterClientBuilderExtensions")] + public static partial class DevCenterClientBuilderExtensions + { + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientOptions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientOptions.cs new file mode 100644 index 000000000000..76316c6f872b --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterClientOptions.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Developer.DevCenter +{ + [CodeGenClient("AzureDeveloperDevCenterClientOptions")] + public partial class DevCenterClientOptions + { + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironment.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironment.cs new file mode 100644 index 000000000000..2859599c6777 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironment.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + [CodeGenSuppress("DevCenterEnvironment", typeof(string), typeof(string), typeof(string))] + public partial class DevCenterEnvironment + { + /// Initializes a new instance of . + /// Environment name. + /// Environment type. + /// Name of the catalog. + /// Name of the environment definition. + /// , , or is null. + public DevCenterEnvironment(string environmentName, string environmentTypeName, string catalogName, string environmentDefinitionName) + { + Argument.AssertNotNull(environmentName, nameof(environmentName)); + Argument.AssertNotNull(environmentTypeName, nameof(environmentTypeName)); + Argument.AssertNotNull(catalogName, nameof(catalogName)); + Argument.AssertNotNull(environmentDefinitionName, nameof(environmentDefinitionName)); + + Parameters = new ChangeTrackingDictionary(); + Name = environmentName; + EnvironmentTypeName = environmentTypeName; + CatalogName = catalogName; + EnvironmentDefinitionName = environmentDefinitionName; + } + + /// The identifier of the resource group containing the environment's resources. + public ResourceIdentifier ResourceGroupId { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironmentType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironmentType.cs new file mode 100644 index 000000000000..17c25b3e8442 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterEnvironmentType.cs @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevCenterEnvironmentType + { + /// + /// Id of a subscription or management group that the environment type will be + /// mapped to. The environment's resources will be deployed into this subscription + /// or management group. + /// + public ResourceIdentifier DeploymentTargetId { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterModelFactory.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterModelFactory.cs new file mode 100644 index 000000000000..20f948a22b57 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/DevCenterModelFactory.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + [CodeGenClient("DeveloperDevCenterModelFactory")] + public static partial class DevCenterModelFactory + { + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DeploymentEnvironmentsClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DeploymentEnvironmentsClient.xml new file mode 100644 index 000000000000..f880264594dd --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DeploymentEnvironmentsClient.xml @@ -0,0 +1,73 @@ + + + + + + This sample shows how to call CreateOrUpdateEnvironmentAsync. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", ""); +Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "", environment); +DevCenterEnvironment responseData = operation.Value; +]]> + + This sample shows how to call CreateOrUpdateEnvironmentAsync with all parameters. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", "") +{ + Parameters = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, +}; +Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "", environment); +DevCenterEnvironment responseData = operation.Value; +]]> + + + + + + This sample shows how to call CreateOrUpdateEnvironment. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", ""); +Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "", environment); +DevCenterEnvironment responseData = operation.Value; +]]> + + This sample shows how to call CreateOrUpdateEnvironment with all parameters. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", "") +{ + Parameters = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, +}; +Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "", environment); +DevCenterEnvironment responseData = operation.Value; +]]> + + + + + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DevBoxesClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DevBoxesClient.xml new file mode 100644 index 000000000000..0e20eafa9c6c --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Custom/Docs/DevBoxesClient.xml @@ -0,0 +1,67 @@ + + + + + + This sample shows how to call CreateDevBoxAsync. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +DevBox devBox = new DevBox("", ""); +Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "", devBox); +DevBox responseData = operation.Value; +]]> + + This sample shows how to call CreateDevBoxAsync with all parameters. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +DevBox devBox = new DevBox("", "") +{ + LocalAdministratorStatus = LocalAdministratorStatus.Enabled, +}; +Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "", devBox); +DevBox responseData = operation.Value; +]]> + + + + + + This sample shows how to call CreateDevBox. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +DevBox devBox = new DevBox("", ""); +Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "", devBox); +DevBox responseData = operation.Value; +]]> + + This sample shows how to call CreateDevBox with all parameters. + + "); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +DevBox devBox = new DevBox("", "") +{ + LocalAdministratorStatus = LocalAdministratorStatus.Enabled, +}; +Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "", devBox); +DevBox responseData = operation.Value; +]]> + + + + + diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs index c15a007c9868..cc35748b809f 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs @@ -6,10 +6,12 @@ #nullable disable using System; +using System.Threading; using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.Developer.DevCenter.Models; namespace Azure.Developer.DevCenter { @@ -38,7 +40,7 @@ protected DeploymentEnvironmentsClient() /// The DevCenter-specific URI to operate on. /// A credential used to authenticate to an Azure Service. /// or is null. - public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AzureDeveloperDevCenterClientOptions()) + public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new DevCenterClientOptions()) { } @@ -47,11 +49,11 @@ protected DeploymentEnvironmentsClient() /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. /// or is null. - public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential, AzureDeveloperDevCenterClientOptions options) + public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential, DevCenterClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); - options ??= new AzureDeveloperDevCenterClientOptions(); + options ??= new DevCenterClientOptions(); ClientDiagnostics = new ClientDiagnostics(options, true); _tokenCredential = credential; @@ -60,6 +62,44 @@ public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential, Az _apiVersion = options.Version; } + /// Gets an environment. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Environment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetEnvironmentAsync(string projectName, string userId, string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetEnvironmentAsync(projectName, userId, environmentName, context).ConfigureAwait(false); + return Response.FromValue(DevCenterEnvironment.FromResponse(response), response); + } + + /// Gets an environment. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Environment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetEnvironment(string projectName, string userId, string environmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetEnvironment(projectName, userId, environmentName, context); + return Response.FromValue(DevCenterEnvironment.FromResponse(response), response); + } + /// /// [Protocol Method] Gets an environment /// @@ -68,11 +108,16 @@ public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential, Az /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of the environment. + /// Environment name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -107,11 +152,16 @@ public virtual async Task GetEnvironmentAsync(string projectName, stri /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of the environment. + /// Environment name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -138,6 +188,40 @@ public virtual Response GetEnvironment(string projectName, string userId, string } } + /// Gets the specified catalog within the project. + /// Name of the project. + /// Name of the catalog. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetCatalogAsync(string projectName, string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetCatalogAsync(projectName, catalogName, context).ConfigureAwait(false); + return Response.FromValue(DevCenterCatalog.FromResponse(response), response); + } + + /// Gets the specified catalog within the project. + /// Name of the project. + /// Name of the catalog. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetCatalog(string projectName, string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetCatalog(projectName, catalogName, context); + return Response.FromValue(DevCenterCatalog.FromResponse(response), response); + } + /// /// [Protocol Method] Gets the specified catalog within the project /// @@ -146,10 +230,15 @@ public virtual Response GetEnvironment(string projectName, string userId, string /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of the catalog. + /// Name of the project. + /// Name of the catalog. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -183,10 +272,15 @@ public virtual async Task GetCatalogAsync(string projectName, string c /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of the catalog. + /// Name of the project. + /// Name of the catalog. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -212,6 +306,44 @@ public virtual Response GetCatalog(string projectName, string catalogName, Reque } } + /// Get an environment definition from a catalog. + /// Name of the project. + /// Name of the catalog. + /// Name of the environment definition. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetEnvironmentDefinitionAsync(string projectName, string catalogName, string definitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + Argument.AssertNotNullOrEmpty(definitionName, nameof(definitionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetEnvironmentDefinitionAsync(projectName, catalogName, definitionName, context).ConfigureAwait(false); + return Response.FromValue(EnvironmentDefinition.FromResponse(response), response); + } + + /// Get an environment definition from a catalog. + /// Name of the project. + /// Name of the catalog. + /// Name of the environment definition. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetEnvironmentDefinition(string projectName, string catalogName, string definitionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + Argument.AssertNotNullOrEmpty(definitionName, nameof(definitionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetEnvironmentDefinition(projectName, catalogName, definitionName, context); + return Response.FromValue(EnvironmentDefinition.FromResponse(response), response); + } + /// /// [Protocol Method] Get an environment definition from a catalog. /// @@ -220,11 +352,16 @@ public virtual Response GetCatalog(string projectName, string catalogName, Reque /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of the catalog. - /// The name of the environment definition. + /// Name of the project. + /// Name of the catalog. + /// Name of the environment definition. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -259,11 +396,16 @@ public virtual async Task GetEnvironmentDefinitionAsync(string project /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of the catalog. - /// The name of the environment definition. + /// Name of the project. + /// Name of the catalog. + /// Name of the environment definition. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -290,6 +432,38 @@ public virtual Response GetEnvironmentDefinition(string projectName, string cata } } + /// Lists the environments for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetAllEnvironmentsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironment.DeserializeDevCenterEnvironment(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); + } + + /// Lists the environments for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetAllEnvironments(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironment.DeserializeDevCenterEnvironment(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists the environments for a project. /// @@ -298,22 +472,26 @@ public virtual Response GetEnvironmentDefinition(string projectName, string cata /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetAllEnvironmentsAsync(string projectName, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetAllEnvironmentsAsync(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); } @@ -325,25 +503,65 @@ public virtual AsyncPageable GetAllEnvironmentsAsync(string projectN /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetAllEnvironments(string projectName, int? maxCount, RequestContext context) + /// + public virtual Pageable GetAllEnvironments(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllEnvironmentsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllEnvironmentsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); } + /// Lists the environments for a project and user. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetEnvironmentsAsync(string projectName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironment.DeserializeDevCenterEnvironment(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); + } + + /// Lists the environments for a project and user. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetEnvironments(string projectName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironment.DeserializeDevCenterEnvironment(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists the environments for a project and user. /// @@ -352,24 +570,28 @@ public virtual Pageable GetAllEnvironments(string projectName, int? /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetEnvironmentsAsync(string projectName, string userId, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentsAsync(string projectName, string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); } @@ -381,27 +603,63 @@ public virtual AsyncPageable GetEnvironmentsAsync(string projectName /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetEnvironments(string projectName, string userId, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironments(string projectName, string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); } + /// Lists all of the catalogs available for a project. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetCatalogsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevCenterCatalog.DeserializeDevCenterCatalog(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); + } + + /// Lists all of the catalogs available for a project. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetCatalogs(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevCenterCatalog.DeserializeDevCenterCatalog(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists all of the catalogs available for a project. /// @@ -410,22 +668,26 @@ public virtual Pageable GetEnvironments(string projectName, string u /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetCatalogsAsync(string projectName, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetCatalogsAsync(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); } @@ -437,25 +699,61 @@ public virtual AsyncPageable GetCatalogsAsync(string projectName, in /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetCatalogs(string projectName, int? maxCount, RequestContext context) + /// + public virtual Pageable GetCatalogs(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); } + /// Lists all environment definitions available for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => EnvironmentDefinition.DeserializeEnvironmentDefinition(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); + } + + /// Lists all environment definitions available for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetEnvironmentDefinitions(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => EnvironmentDefinition.DeserializeEnvironmentDefinition(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists all environment definitions available for a project. /// @@ -464,22 +762,26 @@ public virtual Pageable GetCatalogs(string projectName, int? maxCoun /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); } @@ -491,25 +793,65 @@ public virtual AsyncPageable GetEnvironmentDefinitionsAsync(string p /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetEnvironmentDefinitions(string projectName, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironmentDefinitions(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); } + /// Lists all environment definitions available within a catalog. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => EnvironmentDefinition.DeserializeEnvironmentDefinition(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); + } + + /// Lists all environment definitions available within a catalog. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => EnvironmentDefinition.DeserializeEnvironmentDefinition(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists all environment definitions available within a catalog. /// @@ -518,24 +860,28 @@ public virtual Pageable GetEnvironmentDefinitions(string projectName /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The name of the catalog. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); } @@ -547,27 +893,63 @@ public virtual AsyncPageable GetEnvironmentDefinitionsByCatalogAsync /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The name of the catalog. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); } + /// Lists all environment types configured for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetEnvironmentTypesAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironmentType.DeserializeDevCenterEnvironmentType(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); + } + + /// Lists all environment types configured for a project. + /// The DevCenter Project upon which to execute operations. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetEnvironmentTypes(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevCenterEnvironmentType.DeserializeDevCenterEnvironmentType(e), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists all environment types configured for a project. /// @@ -576,22 +958,26 @@ public virtual Pageable GetEnvironmentDefinitionsByCatalog(string pr /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetEnvironmentTypesAsync(string projectName, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentTypesAsync(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); } @@ -603,22 +989,26 @@ public virtual AsyncPageable GetEnvironmentTypesAsync(string project /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetEnvironmentTypes(string projectName, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironmentTypes(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); } @@ -706,6 +1096,7 @@ public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUnt } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Deletes an environment and all its associated resources /// @@ -746,6 +1137,7 @@ public virtual async Task DeleteEnvironmentAsync(WaitUntil waitUntil, } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Deletes an environment and all its associated resources /// @@ -786,7 +1178,7 @@ public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string projectNa } } - internal HttpMessage CreateGetAllEnvironmentsRequest(string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllEnvironmentsRequest(string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -797,16 +1189,12 @@ internal HttpMessage CreateGetAllEnvironmentsRequest(string projectName, int? ma uri.AppendPath(projectName, true); uri.AppendPath("/environments", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetEnvironmentsRequest(string projectName, string userId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentsRequest(string projectName, string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -819,10 +1207,6 @@ internal HttpMessage CreateGetEnvironmentsRequest(string projectName, string use uri.AppendPath(userId, true); uri.AppendPath("/environments", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -887,7 +1271,7 @@ internal HttpMessage CreateDeleteEnvironmentRequest(string projectName, string u return message; } - internal HttpMessage CreateGetCatalogsRequest(string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetCatalogsRequest(string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -898,10 +1282,6 @@ internal HttpMessage CreateGetCatalogsRequest(string projectName, int? maxCount, uri.AppendPath(projectName, true); uri.AppendPath("/catalogs", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -924,7 +1304,7 @@ internal HttpMessage CreateGetCatalogRequest(string projectName, string catalogN return message; } - internal HttpMessage CreateGetEnvironmentDefinitionsRequest(string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsRequest(string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -935,16 +1315,12 @@ internal HttpMessage CreateGetEnvironmentDefinitionsRequest(string projectName, uri.AppendPath(projectName, true); uri.AppendPath("/environmentDefinitions", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogRequest(string projectName, string catalogName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogRequest(string projectName, string catalogName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -957,10 +1333,6 @@ internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogRequest(string proj uri.AppendPath(catalogName, true); uri.AppendPath("/environmentDefinitions", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -985,7 +1357,7 @@ internal HttpMessage CreateGetEnvironmentDefinitionRequest(string projectName, s return message; } - internal HttpMessage CreateGetEnvironmentTypesRequest(string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentTypesRequest(string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -996,16 +1368,12 @@ internal HttpMessage CreateGetEnvironmentTypesRequest(string projectName, int? m uri.AppendPath(projectName, true); uri.AppendPath("/environmentTypes", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetAllEnvironmentsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllEnvironmentsNextPageRequest(string nextLink, string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1018,7 +1386,7 @@ internal HttpMessage CreateGetAllEnvironmentsNextPageRequest(string nextLink, st return message; } - internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, string projectName, string userId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, string projectName, string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1031,7 +1399,7 @@ internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, strin return message; } - internal HttpMessage CreateGetCatalogsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetCatalogsNextPageRequest(string nextLink, string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1044,7 +1412,7 @@ internal HttpMessage CreateGetCatalogsNextPageRequest(string nextLink, string pr return message; } - internal HttpMessage CreateGetEnvironmentDefinitionsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsNextPageRequest(string nextLink, string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1057,7 +1425,7 @@ internal HttpMessage CreateGetEnvironmentDefinitionsNextPageRequest(string nextL return message; } - internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(string nextLink, string projectName, string catalogName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(string nextLink, string projectName, string catalogName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1070,7 +1438,7 @@ internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(str return message; } - internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1083,6 +1451,17 @@ internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, s return message; } + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); private static ResponseClassifier _responseClassifier201; diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs index c71c0594d463..e657c7524da0 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs @@ -6,10 +6,12 @@ #nullable disable using System; +using System.Threading; using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.Developer.DevCenter.Models; namespace Azure.Developer.DevCenter { @@ -38,7 +40,7 @@ protected DevBoxesClient() /// The DevCenter-specific URI to operate on. /// A credential used to authenticate to an Azure Service. /// or is null. - public DevBoxesClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AzureDeveloperDevCenterClientOptions()) + public DevBoxesClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new DevCenterClientOptions()) { } @@ -47,11 +49,11 @@ protected DevBoxesClient() /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. /// or is null. - public DevBoxesClient(Uri endpoint, TokenCredential credential, AzureDeveloperDevCenterClientOptions options) + public DevBoxesClient(Uri endpoint, TokenCredential credential, DevCenterClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); - options ??= new AzureDeveloperDevCenterClientOptions(); + options ??= new DevCenterClientOptions(); ClientDiagnostics = new ClientDiagnostics(options, true); _tokenCredential = credential; @@ -60,6 +62,40 @@ public DevBoxesClient(Uri endpoint, TokenCredential credential, AzureDeveloperDe _apiVersion = options.Version; } + /// Gets a pool. + /// Name of the project. + /// Pool name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetPoolAsync(string projectName, string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetPoolAsync(projectName, poolName, context).ConfigureAwait(false); + return Response.FromValue(DevBoxPool.FromResponse(response), response); + } + + /// Gets a pool. + /// Name of the project. + /// Pool name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetPool(string projectName, string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetPool(projectName, poolName, context); + return Response.FromValue(DevBoxPool.FromResponse(response), response); + } + /// /// [Protocol Method] Gets a pool /// @@ -68,10 +104,15 @@ public DevBoxesClient(Uri endpoint, TokenCredential credential, AzureDeveloperDe /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. + /// Name of the project. + /// Pool name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -105,10 +146,15 @@ public virtual async Task GetPoolAsync(string projectName, string pool /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. + /// Name of the project. + /// Pool name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -134,6 +180,44 @@ public virtual Response GetPool(string projectName, string poolName, RequestCont } } + /// Gets a schedule. + /// Name of the project. + /// Pool name. + /// Display name for the Schedule. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetScheduleAsync(string projectName, string poolName, string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetScheduleAsync(projectName, poolName, scheduleName, context).ConfigureAwait(false); + return Response.FromValue(DevBoxSchedule.FromResponse(response), response); + } + + /// Gets a schedule. + /// Name of the project. + /// Pool name. + /// Display name for the Schedule. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetSchedule(string projectName, string poolName, string scheduleName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetSchedule(projectName, poolName, scheduleName, context); + return Response.FromValue(DevBoxSchedule.FromResponse(response), response); + } + /// /// [Protocol Method] Gets a schedule. /// @@ -142,11 +226,16 @@ public virtual Response GetPool(string projectName, string poolName, RequestCont /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. - /// The name of a schedule. + /// Name of the project. + /// Pool name. + /// Display name for the Schedule. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -181,11 +270,16 @@ public virtual async Task GetScheduleAsync(string projectName, string /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. - /// The name of a schedule. + /// Name of the project. + /// Pool name. + /// Display name for the Schedule. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -212,6 +306,44 @@ public virtual Response GetSchedule(string projectName, string poolName, string } } + /// Gets a Dev Box. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDevBoxAsync(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDevBoxAsync(projectName, userId, devBoxName, context).ConfigureAwait(false); + return Response.FromValue(DevBox.FromResponse(response), response); + } + + /// Gets a Dev Box. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDevBox(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDevBox(projectName, userId, devBoxName, context); + return Response.FromValue(DevBox.FromResponse(response), response); + } + /// /// [Protocol Method] Gets a Dev Box /// @@ -220,11 +352,16 @@ public virtual Response GetSchedule(string projectName, string poolName, string /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -259,11 +396,16 @@ public virtual async Task GetDevBoxAsync(string projectName, string us /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -290,6 +432,44 @@ public virtual Response GetDevBox(string projectName, string userId, string devB } } + /// Gets RDP Connection info. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The name of a Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetRemoteConnectionAsync(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetRemoteConnectionAsync(projectName, userId, devBoxName, context).ConfigureAwait(false); + return Response.FromValue(RemoteConnection.FromResponse(response), response); + } + + /// Gets RDP Connection info. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The name of a Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetRemoteConnection(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetRemoteConnection(projectName, userId, devBoxName, context); + return Response.FromValue(RemoteConnection.FromResponse(response), response); + } + /// /// [Protocol Method] Gets RDP Connection info /// @@ -298,6 +478,11 @@ public virtual Response GetDevBox(string projectName, string userId, string devB /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. @@ -337,6 +522,11 @@ public virtual async Task GetRemoteConnectionAsync(string projectName, /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. @@ -368,6 +558,48 @@ public virtual Response GetRemoteConnection(string projectName, string userId, s } } + /// Gets an action. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The name of the action. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDevBoxActionAsync(string projectName, string userId, string devBoxName, string actionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDevBoxActionAsync(projectName, userId, devBoxName, actionName, context).ConfigureAwait(false); + return Response.FromValue(DevBoxAction.FromResponse(response), response); + } + + /// Gets an action. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The name of the action. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDevBoxAction(string projectName, string userId, string devBoxName, string actionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDevBoxAction(projectName, userId, devBoxName, actionName, context); + return Response.FromValue(DevBoxAction.FromResponse(response), response); + } + /// /// [Protocol Method] Gets an action. /// @@ -376,12 +608,17 @@ public virtual Response GetRemoteConnection(string projectName, string userId, s /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -417,12 +654,17 @@ public virtual async Task GetDevBoxActionAsync(string projectName, str /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -450,6 +692,7 @@ public virtual Response GetDevBoxAction(string projectName, string userId, strin } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Skips an occurrence of an action. /// @@ -460,10 +703,10 @@ public virtual Response GetDevBoxAction(string projectName, string userId, strin /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -491,6 +734,7 @@ public virtual async Task SkipActionAsync(string projectName, string u } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Skips an occurrence of an action. /// @@ -501,10 +745,10 @@ public virtual async Task SkipActionAsync(string projectName, string u /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. @@ -532,6 +776,50 @@ public virtual Response SkipAction(string projectName, string userId, string dev } } + /// Delays the occurrence of an action. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The name of the action. + /// The time to delay the Dev Box action or actions until. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, DateTimeOffset delayUntil, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await DelayActionAsync(projectName, userId, devBoxName, actionName, delayUntil, context).ConfigureAwait(false); + return Response.FromValue(DevBoxAction.FromResponse(response), response); + } + + /// Delays the occurrence of an action. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The name of the action. + /// The time to delay the Dev Box action or actions until. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + /// + public virtual Response DelayAction(string projectName, string userId, string devBoxName, string actionName, DateTimeOffset delayUntil, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = DelayAction(projectName, userId, devBoxName, actionName, delayUntil, context); + return Response.FromValue(DevBoxAction.FromResponse(response), response); + } + /// /// [Protocol Method] Delays the occurrence of an action. /// @@ -540,12 +828,17 @@ public virtual Response SkipAction(string projectName, string userId, string dev /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The time to delay the Dev Box action or actions until. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. @@ -582,12 +875,17 @@ public virtual async Task DelayActionAsync(string projectName, string /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. - /// The name of an action that will take place on a Dev Box. + /// Display name for the Dev Box. + /// The name of the action. /// The time to delay the Dev Box action or actions until. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , , or is null. @@ -616,6 +914,38 @@ public virtual Response DelayAction(string projectName, string userId, string de } } + /// Lists available pools. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetPoolsAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBoxPool.DeserializeDevBoxPool(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); + } + + /// Lists available pools. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetPools(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBoxPool.DeserializeDevBoxPool(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists available pools /// @@ -624,23 +954,26 @@ public virtual Response DelayAction(string projectName, string userId, string de /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetPoolsAsync(string projectName, string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetPoolsAsync(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); } @@ -652,26 +985,65 @@ public virtual AsyncPageable GetPoolsAsync(string projectName, strin /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetPools(string projectName, string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetPools(string projectName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(projectName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, projectName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); } + /// Lists available schedules for a pool. + /// Name of the project. + /// Pool name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetSchedulesAsync(string projectName, string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBoxSchedule.DeserializeDevBoxSchedule(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); + } + + /// Lists available schedules for a pool. + /// Name of the project. + /// Pool name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetSchedules(string projectName, string poolName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBoxSchedule.DeserializeDevBoxSchedule(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists available schedules for a pool. /// @@ -680,25 +1052,28 @@ public virtual Pageable GetPools(string projectName, string filter, /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. + /// Pool name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetSchedulesAsync(string projectName, string poolName, string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetSchedulesAsync(string projectName, string poolName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); } @@ -710,28 +1085,53 @@ public virtual AsyncPageable GetSchedulesAsync(string projectName, s /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. - /// The name of a pool of Dev Boxes. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// Name of the project. + /// Pool name. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetSchedules(string projectName, string poolName, string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetSchedules(string projectName, string poolName, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); } + /// Lists Dev Boxes that the caller has access to in the DevCenter. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetAllDevBoxesAsync(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); + } + + /// Lists Dev Boxes that the caller has access to in the DevCenter. + /// The cancellation token to use. + /// + public virtual Pageable GetAllDevBoxes(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists Dev Boxes that the caller has access to in the DevCenter. /// @@ -740,18 +1140,21 @@ public virtual Pageable GetSchedules(string projectName, string pool /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetAllDevBoxesAsync(string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetAllDevBoxesAsync(RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); } @@ -763,21 +1166,56 @@ public virtual AsyncPageable GetAllDevBoxesAsync(string filter, int? /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetAllDevBoxes(string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetAllDevBoxes(RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); } + /// Lists Dev Boxes in the Dev Center for a particular user. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetAllDevBoxesByUserAsync(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); + } + + /// Lists Dev Boxes in the Dev Center for a particular user. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetAllDevBoxesByUser(string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists Dev Boxes in the Dev Center for a particular user. /// @@ -786,23 +1224,26 @@ public virtual Pageable GetAllDevBoxes(string filter, int? maxCount, /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetAllDevBoxesByUserAsync(string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetAllDevBoxesByUserAsync(string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); } @@ -814,26 +1255,65 @@ public virtual AsyncPageable GetAllDevBoxesByUserAsync(string userId /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetAllDevBoxesByUser(string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetAllDevBoxesByUser(string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); } + /// Lists Dev Boxes in the project for a particular user. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetDevBoxesAsync(string projectName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); + } + + /// Lists Dev Boxes in the project for a particular user. + /// The DevCenter Project upon which to execute operations. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetDevBoxes(string projectName, string userId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBox.DeserializeDevBox(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists Dev Boxes in the project for a particular user. /// @@ -842,25 +1322,28 @@ public virtual Pageable GetAllDevBoxesByUser(string userId, string f /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetDevBoxesAsync(string projectName, string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetDevBoxesAsync(string projectName, string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); } @@ -872,28 +1355,71 @@ public virtual AsyncPageable GetDevBoxesAsync(string projectName, st /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The DevCenter Project upon which to execute operations. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// or is null. /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetDevBoxes(string projectName, string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetDevBoxes(string projectName, string userId, RequestContext context) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesRequest(projectName, userId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesNextPageRequest(nextLink, projectName, userId, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); } + /// Lists actions on a Dev Box. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetDevBoxActionsAsync(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxActionsRequest(projectName, userId, devBoxName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxActionsNextPageRequest(nextLink, projectName, userId, devBoxName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBoxAction.DeserializeDevBoxAction(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxActions", "value", "nextLink", context); + } + + /// Lists actions on a Dev Box. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetDevBoxActions(string projectName, string userId, string devBoxName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxActionsRequest(projectName, userId, devBoxName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxActionsNextPageRequest(nextLink, projectName, userId, devBoxName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBoxAction.DeserializeDevBoxAction(e), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxActions", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists actions on a Dev Box. /// @@ -902,11 +1428,16 @@ public virtual Pageable GetDevBoxes(string projectName, string userI /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -932,11 +1463,16 @@ public virtual AsyncPageable GetDevBoxActionsAsync(string projectNam /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -954,6 +1490,48 @@ public virtual Pageable GetDevBoxActions(string projectName, string return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxActions", "value", "nextLink", context); } + /// Delays all actions. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The time to delay the Dev Box action or actions until. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, DateTimeOffset delayUntil, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateDelayAllActionsRequest(projectName, userId, devBoxName, delayUntil, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateDelayAllActionsNextPageRequest(nextLink, projectName, userId, devBoxName, delayUntil, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevBoxActionDelayResult.DeserializeDevBoxActionDelayResult(e), ClientDiagnostics, _pipeline, "DevBoxesClient.DelayAllActions", "value", "nextLink", context); + } + + /// Delays all actions. + /// Name of the project. + /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. + /// Display name for the Dev Box. + /// The time to delay the Dev Box action or actions until. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + /// + public virtual Pageable DelayAllActions(string projectName, string userId, string devBoxName, DateTimeOffset delayUntil, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateDelayAllActionsRequest(projectName, userId, devBoxName, delayUntil, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateDelayAllActionsNextPageRequest(nextLink, projectName, userId, devBoxName, delayUntil, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevBoxActionDelayResult.DeserializeDevBoxActionDelayResult(e), ClientDiagnostics, _pipeline, "DevBoxesClient.DelayAllActions", "value", "nextLink", context); + } + /// /// [Protocol Method] Delays all actions. /// @@ -962,11 +1540,16 @@ public virtual Pageable GetDevBoxActions(string projectName, string /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The time to delay the Dev Box action or actions until. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. @@ -993,11 +1576,16 @@ public virtual AsyncPageable DelayAllActionsAsync(string projectName /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The time to delay the Dev Box action or actions until. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. @@ -1027,7 +1615,7 @@ public virtual Pageable DelayAllActions(string projectName, string u /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// The DevCenter Project upon which to execute the operation. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// The name of a Dev Box. /// The content to send as the body of the request. @@ -1069,7 +1657,7 @@ public virtual async Task> CreateDevBoxAsync(WaitUntil wai /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// The DevCenter Project upon which to execute the operation. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. /// The name of a Dev Box. /// The content to send as the body of the request. @@ -1100,6 +1688,7 @@ public virtual Operation CreateDevBox(WaitUntil waitUntil, string pr } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Deletes a Dev Box. /// @@ -1140,6 +1729,7 @@ public virtual async Task DeleteDevBoxAsync(WaitUntil waitUntil, stri } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Deletes a Dev Box. /// @@ -1180,6 +1770,7 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, s } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Starts a Dev Box /// @@ -1191,9 +1782,9 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, s /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1220,6 +1811,7 @@ public virtual async Task StartDevBoxAsync(WaitUntil waitUntil, strin } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Starts a Dev Box /// @@ -1231,9 +1823,9 @@ public virtual async Task StartDevBoxAsync(WaitUntil waitUntil, strin /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1260,6 +1852,7 @@ public virtual Operation StartDevBox(WaitUntil waitUntil, string projectName, st } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Stops a Dev Box /// @@ -1271,9 +1864,9 @@ public virtual Operation StartDevBox(WaitUntil waitUntil, string projectName, st /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// Optional parameter to hibernate the dev box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. @@ -1301,6 +1894,7 @@ public virtual async Task StopDevBoxAsync(WaitUntil waitUntil, string } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Stops a Dev Box /// @@ -1312,9 +1906,9 @@ public virtual async Task StopDevBoxAsync(WaitUntil waitUntil, string /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// Optional parameter to hibernate the dev box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. @@ -1342,6 +1936,7 @@ public virtual Operation StopDevBox(WaitUntil waitUntil, string projectName, str } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Restarts a Dev Box /// @@ -1353,9 +1948,9 @@ public virtual Operation StopDevBox(WaitUntil waitUntil, string projectName, str /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1382,6 +1977,7 @@ public virtual async Task RestartDevBoxAsync(WaitUntil waitUntil, str } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// /// [Protocol Method] Restarts a Dev Box /// @@ -1393,9 +1989,9 @@ public virtual async Task RestartDevBoxAsync(WaitUntil waitUntil, str /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. - /// The name of a Dev Box. + /// Display name for the Dev Box. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -1422,7 +2018,7 @@ public virtual Operation RestartDevBox(WaitUntil waitUntil, string projectName, } } - internal HttpMessage CreateGetPoolsRequest(string projectName, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetPoolsRequest(string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1433,14 +2029,6 @@ internal HttpMessage CreateGetPoolsRequest(string projectName, string filter, in uri.AppendPath(projectName, true); uri.AppendPath("/pools", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1463,7 +2051,7 @@ internal HttpMessage CreateGetPoolRequest(string projectName, string poolName, R return message; } - internal HttpMessage CreateGetSchedulesRequest(string projectName, string poolName, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetSchedulesRequest(string projectName, string poolName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1476,14 +2064,6 @@ internal HttpMessage CreateGetSchedulesRequest(string projectName, string poolNa uri.AppendPath(poolName, true); uri.AppendPath("/schedules", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1508,7 +2088,7 @@ internal HttpMessage CreateGetScheduleRequest(string projectName, string poolNam return message; } - internal HttpMessage CreateGetAllDevBoxesRequest(string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllDevBoxesRequest(RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1517,20 +2097,12 @@ internal HttpMessage CreateGetAllDevBoxesRequest(string filter, int? maxCount, R uri.Reset(_endpoint); uri.AppendPath("/devboxes", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetAllDevBoxesByUserRequest(string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllDevBoxesByUserRequest(string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1541,20 +2113,12 @@ internal HttpMessage CreateGetAllDevBoxesByUserRequest(string userId, string fil uri.AppendPath(userId, true); uri.AppendPath("/devboxes", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetDevBoxesRequest(string projectName, string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetDevBoxesRequest(string projectName, string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1567,14 +2131,6 @@ internal HttpMessage CreateGetDevBoxesRequest(string projectName, string userId, uri.AppendPath(userId, true); uri.AppendPath("/devboxes", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1830,7 +2386,7 @@ internal HttpMessage CreateDelayAllActionsRequest(string projectName, string use return message; } - internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, string projectName, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, string projectName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1843,7 +2399,7 @@ internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, string proje return message; } - internal HttpMessage CreateGetSchedulesNextPageRequest(string nextLink, string projectName, string poolName, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetSchedulesNextPageRequest(string nextLink, string projectName, string poolName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1856,7 +2412,7 @@ internal HttpMessage CreateGetSchedulesNextPageRequest(string nextLink, string p return message; } - internal HttpMessage CreateGetAllDevBoxesNextPageRequest(string nextLink, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllDevBoxesNextPageRequest(string nextLink, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1869,7 +2425,7 @@ internal HttpMessage CreateGetAllDevBoxesNextPageRequest(string nextLink, string return message; } - internal HttpMessage CreateGetAllDevBoxesByUserNextPageRequest(string nextLink, string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllDevBoxesByUserNextPageRequest(string nextLink, string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1882,7 +2438,7 @@ internal HttpMessage CreateGetAllDevBoxesByUserNextPageRequest(string nextLink, return message; } - internal HttpMessage CreateGetDevBoxesNextPageRequest(string nextLink, string projectName, string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetDevBoxesNextPageRequest(string nextLink, string projectName, string userId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1921,6 +2477,17 @@ internal HttpMessage CreateDelayAllActionsNextPageRequest(string nextLink, strin return message; } + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); private static ResponseClassifier _responseClassifier200201; diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs index 80387296e401..ea297803f580 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs @@ -6,10 +6,12 @@ #nullable disable using System; +using System.Threading; using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; +using Azure.Developer.DevCenter.Models; namespace Azure.Developer.DevCenter { @@ -38,26 +40,38 @@ protected DevCenterClient() /// The DevCenter-specific URI to operate on. /// A credential used to authenticate to an Azure Service. /// or is null. - public DevCenterClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AzureDeveloperDevCenterClientOptions()) + public DevCenterClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new DevCenterClientOptions()) { } - /// Initializes a new instance of DevCenterClient. - /// The DevCenter-specific URI to operate on. - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - /// or is null. - public DevCenterClient(Uri endpoint, TokenCredential credential, AzureDeveloperDevCenterClientOptions options) + /// Gets a project. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetProjectAsync(string projectName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetProjectAsync(projectName, context).ConfigureAwait(false); + return Response.FromValue(DevCenterProject.FromResponse(response), response); + } + + /// Gets a project. + /// Name of the project. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetProject(string projectName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); - options ??= new AzureDeveloperDevCenterClientOptions(); - - ClientDiagnostics = new ClientDiagnostics(options, true); - _tokenCredential = credential; - _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); - _endpoint = endpoint; - _apiVersion = options.Version; + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetProject(projectName, context); + return Response.FromValue(DevCenterProject.FromResponse(response), response); } /// @@ -68,9 +82,14 @@ public DevCenterClient(Uri endpoint, TokenCredential credential, AzureDeveloperD /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. @@ -103,9 +122,14 @@ public virtual async Task GetProjectAsync(string projectName, RequestC /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// The DevCenter Project upon which to execute operations. + /// Name of the project. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. @@ -130,6 +154,28 @@ public virtual Response GetProject(string projectName, RequestContext context) } } + /// Lists all projects. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetProjectsAsync(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DevCenterProject.DeserializeDevCenterProject(e), ClientDiagnostics, _pipeline, "DevCenterClient.GetProjects", "value", "nextLink", context); + } + + /// Lists all projects. + /// The cancellation token to use. + /// + public virtual Pageable GetProjects(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DevCenterProject.DeserializeDevCenterProject(e), ClientDiagnostics, _pipeline, "DevCenterClient.GetProjects", "value", "nextLink", context); + } + /// /// [Protocol Method] Lists all projects. /// @@ -138,18 +184,21 @@ public virtual Response GetProject(string projectName, RequestContext context) /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetProjectsAsync(string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetProjectsAsync(RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetProjects", "value", "nextLink", context); } @@ -161,22 +210,25 @@ public virtual AsyncPageable GetProjectsAsync(string filter, int? ma /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// - /// An OData filter clause to apply to the operation. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetProjects(string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetProjects(RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, filter, maxCount, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetProjects", "value", "nextLink", context); } - internal HttpMessage CreateGetProjectsRequest(string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetProjectsRequest(RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -185,14 +237,6 @@ internal HttpMessage CreateGetProjectsRequest(string filter, int? maxCount, Requ uri.Reset(_endpoint); uri.AppendPath("/projects", false); uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("filter", filter, true); - } - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -213,7 +257,7 @@ internal HttpMessage CreateGetProjectRequest(string projectName, RequestContext return message; } - internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -226,6 +270,17 @@ internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, string fi return message; } + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientBuilderExtensions.cs similarity index 65% rename from sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs rename to sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientBuilderExtensions.cs index 865c9f1049d4..c4773fd432d4 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientBuilderExtensions.cs @@ -12,58 +12,58 @@ namespace Microsoft.Extensions.Azure { /// Extension methods to add , , to client builder. - public static partial class DeveloperDevCenterClientBuilderExtensions + public static partial class DevCenterClientBuilderExtensions { /// Registers a instance. /// The builder to register with. /// The DevCenter-specific URI to operate on. - public static IAzureClientBuilder AddDevCenterClient(this TBuilder builder, Uri endpoint) + public static IAzureClientBuilder AddDevCenterClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new DevCenterClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, cred) => new DevCenterClient(endpoint, cred, options)); } /// Registers a instance. /// The builder to register with. /// The DevCenter-specific URI to operate on. - public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, Uri endpoint) + public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new DevBoxesClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, cred) => new DevBoxesClient(endpoint, cred, options)); } /// Registers a instance. /// The builder to register with. /// The DevCenter-specific URI to operate on. - public static IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, Uri endpoint) + public static IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new DeploymentEnvironmentsClient(endpoint, cred, options)); + return builder.RegisterClientFactory((options, cred) => new DeploymentEnvironmentsClient(endpoint, cred, options)); } /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddDevCenterClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddDevCenterClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/AzureDeveloperDevCenterClientOptions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs similarity index 76% rename from sdk/devcenter/Azure.Developer.DevCenter/src/Generated/AzureDeveloperDevCenterClientOptions.cs rename to sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs index 20f4158b8464..e16c4c75374d 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/AzureDeveloperDevCenterClientOptions.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs @@ -11,7 +11,7 @@ namespace Azure.Developer.DevCenter { /// Client options for Azure.Developer.DevCenter library clients. - public partial class AzureDeveloperDevCenterClientOptions : ClientOptions + public partial class DevCenterClientOptions : ClientOptions { private const ServiceVersion LatestVersion = ServiceVersion.V2023_04_01; @@ -24,8 +24,8 @@ public enum ServiceVersion internal string Version { get; } - /// Initializes new instance of AzureDeveloperDevCenterClientOptions. - public AzureDeveloperDevCenterClientOptions(ServiceVersion version = LatestVersion) + /// Initializes new instance of DevCenterClientOptions. + public DevCenterClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs new file mode 100644 index 000000000000..8c78e318abc8 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterModelFactory.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + /// Model factory for models. + public static partial class DevCenterModelFactory + { + /// Initializes a new instance of . + /// Name of the project. + /// Description of the project. + /// + /// When specified, indicates the maximum number of Dev Boxes a single user can + /// create across all pools in the project. + /// + /// A new instance for mocking. + public static DevCenterProject DevCenterProject(string name = null, string description = null, int? maxDevBoxesPerUser = null) + { + return new DevCenterProject(name, description, maxDevBoxesPerUser, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Pool name. + /// Azure region where Dev Boxes in the pool are located. + /// The operating system type of Dev Boxes in this pool. + /// Hardware settings for the Dev Boxes created in this pool. + /// Indicates whether hibernate is enabled/disabled or unknown. + /// Storage settings for Dev Box created in this pool. + /// Image settings for Dev Boxes create in this pool. + /// + /// Indicates whether owners of Dev Boxes in this pool are local administrators on + /// the Dev Boxes. + /// + /// Stop on disconnect configuration settings for Dev Boxes created in this pool. + /// + /// Overall health status of the Pool. Indicates whether or not the Pool is + /// available to create Dev Boxes. + /// + /// A new instance for mocking. + public static DevBoxPool DevBoxPool(string name = null, AzureLocation location = default, DevBoxOSType? osType = null, DevBoxHardwareProfile hardwareProfile = null, HibernateSupport? hibernateSupport = null, DevBoxStorageProfile storageProfile = null, DevBoxImageReference imageReference = null, LocalAdministratorStatus? localAdministratorStatus = null, StopOnDisconnectConfiguration stopOnDisconnect = null, PoolHealthStatus healthStatus = default) + { + return new DevBoxPool( + name, + location, + osType, + hardwareProfile, + hibernateSupport, + storageProfile, + imageReference, + localAdministratorStatus, + stopOnDisconnect, + healthStatus, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The number of vCPUs available for the Dev Box. + /// The amount of memory available for the Dev Box. + /// A new instance for mocking. + public static DevBoxHardwareProfile DevBoxHardwareProfile(SkuName? skuName = null, int? vcpUs = null, int? memoryGB = null) + { + return new DevBoxHardwareProfile(skuName, vcpUs, memoryGB, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Settings for the operating system disk. + /// A new instance for mocking. + public static DevBoxStorageProfile DevBoxStorageProfile(OSDisk osDisk = null) + { + return new DevBoxStorageProfile(osDisk, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The size of the OS Disk in gigabytes. + /// A new instance for mocking. + public static OSDisk OSDisk(int? diskSizeGB = null) + { + return new OSDisk(diskSizeGB, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the image used. + /// The version of the image. + /// The operating system of the image. + /// The operating system build number of the image. + /// The datetime that the backing image version was published. + /// A new instance for mocking. + public static DevBoxImageReference DevBoxImageReference(string name = null, string version = null, string operatingSystem = null, string osBuildNumber = null, DateTimeOffset? publishedDate = null) + { + return new DevBoxImageReference( + name, + version, + operatingSystem, + osBuildNumber, + publishedDate, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Indicates whether the feature to stop the devbox on disconnect once the grace + /// period has lapsed is enabled. + /// + /// + /// The specified time in minutes to wait before stopping a Dev Box once disconnect + /// is detected. + /// + /// A new instance for mocking. + public static StopOnDisconnectConfiguration StopOnDisconnectConfiguration(StopOnDisconnectStatus status = default, int? gracePeriodMinutes = null) + { + return new StopOnDisconnectConfiguration(status, gracePeriodMinutes, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name for the Schedule. + /// Supported type this scheduled task represents. + /// The frequency of this scheduled task. + /// The target time to trigger the action. The format is HH:MM. + /// The IANA timezone id at which the schedule should execute. + /// A new instance for mocking. + public static DevBoxSchedule DevBoxSchedule(string name = null, ScheduleType scheduleType = default, ScheduleFrequency scheduleFrequency = default, string time = null, string timeZone = null) + { + return new DevBoxSchedule( + name, + scheduleType, + scheduleFrequency, + time, + timeZone, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Display name for the Dev Box. + /// Name of the project this Dev Box belongs to. + /// The name of the Dev Box pool this machine belongs to. + /// Indicates whether hibernate is enabled/disabled or unknown. + /// The current provisioning state of the Dev Box. + /// + /// The current action state of the Dev Box. This is state is based on previous + /// action performed by user. + /// + /// The current power state of the Dev Box. + /// + /// A unique identifier for the Dev Box. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + /// Provisioning or action error details. Populated only for error states. + /// + /// Azure region where this Dev Box is located. This will be the same region as the + /// Virtual Network it is attached to. + /// + /// The operating system type of this Dev Box. + /// The AAD object id of the user this Dev Box is assigned to. + /// Information about the Dev Box's hardware resources. + /// Storage settings for this Dev Box. + /// Information about the image used for this Dev Box. + /// Creation time of this Dev Box. + /// Indicates whether the owner of the Dev Box is a local administrator. + /// A new instance for mocking. + public static DevBox DevBox(string name = null, string projectName = null, string poolName = null, HibernateSupport? hibernateSupport = null, DevBoxProvisioningState? provisioningState = null, string actionState = null, PowerState? powerState = null, Guid? uniqueId = null, ResponseError error = null, AzureLocation? location = null, DevBoxOSType? osType = null, Guid? userId = null, DevBoxHardwareProfile hardwareProfile = null, DevBoxStorageProfile storageProfile = null, DevBoxImageReference imageReference = null, DateTimeOffset? createdTime = null, LocalAdministratorStatus? localAdministratorStatus = null) + { + return new DevBox( + name, + projectName, + poolName, + hibernateSupport, + provisioningState, + actionState, + powerState, + uniqueId, + error, + location, + osType, + userId, + hardwareProfile, + storageProfile, + imageReference, + createdTime, + localAdministratorStatus, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// URL to open a browser based RDP session. + /// Link to open a Remote Desktop session. + /// A new instance for mocking. + public static RemoteConnection RemoteConnection(Uri webUri = null, Uri rdpConnectionUri = null) + { + return new RemoteConnection(webUri, rdpConnectionUri, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the action. + /// The action that will be taken. + /// The id of the resource which triggered this action. + /// The earliest time that the action could occur (UTC). + /// Details about the next run of this action. + /// A new instance for mocking. + public static DevBoxAction DevBoxAction(string name = null, DevBoxActionType actionType = default, string sourceId = null, DateTimeOffset? suspendedUntil = null, DevBoxNextAction nextAction = null) + { + return new DevBoxAction( + name, + actionType, + sourceId, + suspendedUntil, + nextAction, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The time the action will be triggered (UTC). + /// A new instance for mocking. + public static DevBoxNextAction DevBoxNextAction(DateTimeOffset scheduledTime = default) + { + return new DevBoxNextAction(scheduledTime, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the action. + /// The result of the delay operation on this action. + /// The delayed action. + /// Information about the error that occurred. Only populated on error. + /// A new instance for mocking. + public static DevBoxActionDelayResult DevBoxActionDelayResult(string actionName = null, DevBoxActionDelayStatus delayStatus = default, DevBoxAction action = null, ResponseError error = null) + { + return new DevBoxActionDelayResult(actionName, delayStatus, action, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Parameters object for the environment. + /// Environment name. + /// Environment type. + /// The AAD object id of the owner of this Environment. + /// The provisioning state of the environment. + /// The identifier of the resource group containing the environment's resources. + /// Name of the catalog. + /// Name of the environment definition. + /// Provisioning error details. Populated only for error states. + /// A new instance for mocking. + public static DevCenterEnvironment DevCenterEnvironment(IDictionary parameters = null, string name = null, string environmentTypeName = null, Guid? userId = null, EnvironmentProvisioningState? provisioningState = null, ResourceIdentifier resourceGroupId = null, string catalogName = null, string environmentDefinitionName = null, ResponseError error = null) + { + parameters ??= new Dictionary(); + + return new DevCenterEnvironment( + parameters, + name, + environmentTypeName, + userId, + provisioningState, + resourceGroupId, + catalogName, + environmentDefinitionName, + error, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the catalog. + /// A new instance for mocking. + public static DevCenterCatalog DevCenterCatalog(string name = null) + { + return new DevCenterCatalog(name, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the environment definition. + /// Name of the environment definition. + /// Name of the catalog. + /// A short description of the environment definition. + /// Input parameters passed to an environment. + /// JSON schema defining the parameters object passed to an environment. + /// Path to the Environment Definition entrypoint file. + /// A new instance for mocking. + public static EnvironmentDefinition EnvironmentDefinition(string id = null, string name = null, string catalogName = null, string description = null, IEnumerable parameters = null, string parametersSchema = null, string templatePath = null) + { + parameters ??= new List(); + + return new EnvironmentDefinition( + id, + name, + catalogName, + description, + parameters?.ToList(), + parametersSchema, + templatePath, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique ID of the parameter. + /// Display name of the parameter. + /// Description of the parameter. + /// Default value of the parameter. + /// + /// A string of one of the basic JSON types (number, integer, array, object, + /// boolean, string) + /// + /// + /// Whether or not this parameter is read-only. If true, default should have a + /// value. + /// + /// Whether or not this parameter is required. + /// An array of allowed values. + /// A new instance for mocking. + public static EnvironmentDefinitionParameter EnvironmentDefinitionParameter(string id = null, string name = null, string description = null, string defaultValue = null, EnvironmentDefinitionParameterType parameterType = default, bool? readOnly = null, bool required = default, IEnumerable allowed = null) + { + allowed ??= new List(); + + return new EnvironmentDefinitionParameter( + id, + name, + description, + defaultValue, + parameterType, + readOnly, + required, + allowed?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the environment type. + /// + /// Id of a subscription or management group that the environment type will be + /// mapped to. The environment's resources will be deployed into this subscription + /// or management group. + /// + /// Indicates whether this environment type is enabled for use in this project. + /// A new instance for mocking. + public static DevCenterEnvironmentType DevCenterEnvironmentType(string name = null, ResourceIdentifier deploymentTargetId = null, EnvironmentTypeStatus status = default) + { + return new DevCenterEnvironmentType(name, deploymentTargetId, status, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml index 53e2b5c99dfa..4cab4d449bb5 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml @@ -1,6 +1,44 @@ + + +This sample shows how to call GetEnvironmentAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentAsync("", "", ""); +]]> +This sample shows how to call GetEnvironmentAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentAsync("", "", ""); +]]> + + + +This sample shows how to call GetEnvironment. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironment("", "", ""); +]]> +This sample shows how to call GetEnvironment with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironment("", "", ""); +]]> + This sample shows how to call GetEnvironmentAsync and parse the result. @@ -12,6 +50,7 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, Response response = await client.GetEnvironmentAsync("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -25,7 +64,7 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, Response response = await client.GetEnvironmentAsync("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("parameters").ToString()); +Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -50,6 +89,7 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, Response response = client.GetEnvironment("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -63,7 +103,7 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, Response response = client.GetEnvironment("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("parameters").ToString()); +Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -75,6 +115,44 @@ Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call GetCatalogAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetCatalogAsync("", ""); +]]> +This sample shows how to call GetCatalogAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetCatalogAsync("", ""); +]]> + + + +This sample shows how to call GetCatalog. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetCatalog("", ""); +]]> +This sample shows how to call GetCatalog with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetCatalog("", ""); ]]> @@ -125,6 +203,44 @@ Response response = client.GetCatalog("", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call GetEnvironmentDefinitionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); +]]> +This sample shows how to call GetEnvironmentDefinitionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); +]]> + + + +This sample shows how to call GetEnvironmentDefinition. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironmentDefinition("", "", ""); +]]> +This sample shows how to call GetEnvironmentDefinition with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironmentDefinition("", "", ""); ]]> @@ -207,7 +323,53 @@ Console.WriteLine(result.GetProperty("parametersSchema").ToString()); Console.WriteLine(result.GetProperty("templatePath").ToString()); ]]> - + + +This sample shows how to call GetAllEnvironmentsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("")) +{ +} +]]> +This sample shows how to call GetAllEnvironmentsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("")) +{ +} +]]> + + + +This sample shows how to call GetAllEnvironments. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironment item in client.GetAllEnvironments("")) +{ +} +]]> +This sample shows how to call GetAllEnvironments with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironment item in client.GetAllEnvironments("")) +{ +} +]]> + + This sample shows how to call GetAllEnvironmentsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null, null)) +await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -229,10 +392,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", 1234, null)) +await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -247,7 +410,7 @@ await foreach (BinaryData item in client.GetAllEnvironmentsAsync("" } ]]> - + This sample shows how to call GetAllEnvironments and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetAllEnvironments("", null, null)) +foreach (BinaryData item in client.GetAllEnvironments("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -269,10 +433,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetAllEnvironments("", 1234, null)) +foreach (BinaryData item in client.GetAllEnvironments("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -287,7 +451,53 @@ foreach (BinaryData item in client.GetAllEnvironments("", 1234, nul } ]]> - + + +This sample shows how to call GetEnvironmentsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironment item in client.GetEnvironmentsAsync("", "")) +{ +} +]]> +This sample shows how to call GetEnvironmentsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironment item in client.GetEnvironmentsAsync("", "")) +{ +} +]]> + + + +This sample shows how to call GetEnvironments. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironment item in client.GetEnvironments("", "")) +{ +} +]]> +This sample shows how to call GetEnvironments with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironment item in client.GetEnvironments("", "")) +{ +} +]]> + + This sample shows how to call GetEnvironmentsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null, null)) +await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -309,10 +520,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", 1234, null)) +await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -327,7 +538,7 @@ await foreach (BinaryData item in client.GetEnvironmentsAsync("", " } ]]> - + This sample shows how to call GetEnvironments and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironments("", "", null, null)) +foreach (BinaryData item in client.GetEnvironments("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -349,10 +561,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironments("", "", 1234, null)) +foreach (BinaryData item in client.GetEnvironments("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -367,7 +579,53 @@ foreach (BinaryData item in client.GetEnvironments("", "", } ]]> - + + +This sample shows how to call GetCatalogsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterCatalog item in client.GetCatalogsAsync("")) +{ +} +]]> +This sample shows how to call GetCatalogsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterCatalog item in client.GetCatalogsAsync("")) +{ +} +]]> + + + +This sample shows how to call GetCatalogs. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterCatalog item in client.GetCatalogs("")) +{ +} +]]> +This sample shows how to call GetCatalogs with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterCatalog item in client.GetCatalogs("")) +{ +} +]]> + + This sample shows how to call GetCatalogsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetCatalogsAsync("", null, null)) +await foreach (BinaryData item in client.GetCatalogsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -387,14 +645,14 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetCatalogsAsync("", 1234, null)) +await foreach (BinaryData item in client.GetCatalogsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); } ]]> - + This sample shows how to call GetCatalogs and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetCatalogs("", null, null)) +foreach (BinaryData item in client.GetCatalogs("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -414,14 +672,60 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetCatalogs("", 1234, null)) +foreach (BinaryData item in client.GetCatalogs("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); } ]]> - + + +This sample shows how to call GetEnvironmentDefinitionsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsAsync("")) +{ +} +]]> +This sample shows how to call GetEnvironmentDefinitionsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsAsync("")) +{ +} +]]> + + + +This sample shows how to call GetEnvironmentDefinitions. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitions("")) +{ +} +]]> +This sample shows how to call GetEnvironmentDefinitions with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitions("")) +{ +} +]]> + + This sample shows how to call GetEnvironmentDefinitionsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null, null)) +await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -443,7 +747,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", 1234, null)) +await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -463,7 +767,7 @@ await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync(" - + This sample shows how to call GetEnvironmentDefinitions and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentDefinitions("", null, null)) +foreach (BinaryData item in client.GetEnvironmentDefinitions("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -485,7 +789,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentDefinitions("", 1234, null)) +foreach (BinaryData item in client.GetEnvironmentDefinitions("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -505,7 +809,53 @@ foreach (BinaryData item in client.GetEnvironmentDefinitions("", 12 } ]]> - + + +This sample shows how to call GetEnvironmentDefinitionsByCatalogAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalogAsync("", "")) +{ +} +]]> +This sample shows how to call GetEnvironmentDefinitionsByCatalogAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalogAsync("", "")) +{ +} +]]> + + + +This sample shows how to call GetEnvironmentDefinitionsByCatalog. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalog("", "")) +{ +} +]]> +This sample shows how to call GetEnvironmentDefinitionsByCatalog with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalog("", "")) +{ +} +]]> + + This sample shows how to call GetEnvironmentDefinitionsByCatalogAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null, null)) +await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -527,7 +877,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", 1234, null)) +await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -547,7 +897,7 @@ await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync } ]]> - + This sample shows how to call GetEnvironmentDefinitionsByCatalog and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null, null)) +foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -569,7 +919,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", 1234, null)) +foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -589,7 +939,53 @@ foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog(" - + + +This sample shows how to call GetEnvironmentTypesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypesAsync("")) +{ +} +]]> +This sample shows how to call GetEnvironmentTypesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypesAsync("")) +{ +} +]]> + + + +This sample shows how to call GetEnvironmentTypes. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypes("")) +{ +} +]]> +This sample shows how to call GetEnvironmentTypes with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypes("")) +{ +} +]]> + + This sample shows how to call GetEnvironmentTypesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null, null)) +await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -611,7 +1007,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", 1234, null)) +await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -620,7 +1016,7 @@ await foreach (BinaryData item in client.GetEnvironmentTypesAsync(" } ]]> - + This sample shows how to call GetEnvironmentTypes and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentTypes("", null, null)) +foreach (BinaryData item in client.GetEnvironmentTypes("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -642,7 +1038,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -foreach (BinaryData item in client.GetEnvironmentTypes("", 1234, null)) +foreach (BinaryData item in client.GetEnvironmentTypes("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -669,6 +1065,7 @@ Operation operation = await client.CreateOrUpdateEnvironmentAsync(Wa BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -681,7 +1078,10 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, using RequestContent content = RequestContent.Create(new { - parameters = new object(), + parameters = new + { + key = new object(), + }, environmentType = "", catalogName = "", environmentDefinitionName = "", @@ -690,7 +1090,7 @@ Operation operation = await client.CreateOrUpdateEnvironmentAsync(Wa BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("parameters").ToString()); +Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -722,6 +1122,7 @@ Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Com BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -734,7 +1135,10 @@ DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, using RequestContent content = RequestContent.Create(new { - parameters = new object(), + parameters = new + { + key = new object(), + }, environmentType = "", catalogName = "", environmentDefinitionName = "", @@ -743,7 +1147,7 @@ Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Com BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("parameters").ToString()); +Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml index 22d3c0bf162d..5f33277fbe27 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml @@ -1,6 +1,44 @@ + + +This sample shows how to call GetPoolAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetPoolAsync("", ""); +]]> +This sample shows how to call GetPoolAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetPoolAsync("", ""); +]]> + + + +This sample shows how to call GetPool. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetPool("", ""); +]]> +This sample shows how to call GetPool with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetPool("", ""); +]]> + This sample shows how to call GetPoolAsync and parse the result. @@ -85,6 +123,44 @@ Console.WriteLine(result.GetProperty("localAdministrator").ToString()); Console.WriteLine(result.GetProperty("stopOnDisconnect").GetProperty("status").ToString()); Console.WriteLine(result.GetProperty("stopOnDisconnect").GetProperty("gracePeriodMinutes").ToString()); Console.WriteLine(result.GetProperty("healthStatus").ToString()); +]]> + + + +This sample shows how to call GetScheduleAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetScheduleAsync("", "", ""); +]]> +This sample shows how to call GetScheduleAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetScheduleAsync("", "", ""); +]]> + + + +This sample shows how to call GetSchedule. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetSchedule("", "", ""); +]]> +This sample shows how to call GetSchedule with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetSchedule("", "", ""); ]]> @@ -151,6 +227,44 @@ Console.WriteLine(result.GetProperty("type").ToString()); Console.WriteLine(result.GetProperty("frequency").ToString()); Console.WriteLine(result.GetProperty("time").ToString()); Console.WriteLine(result.GetProperty("timeZone").ToString()); +]]> + + + +This sample shows how to call GetDevBoxAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetDevBoxAsync("", "", ""); +]]> +This sample shows how to call GetDevBoxAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetDevBoxAsync("", "", ""); +]]> + + + +This sample shows how to call GetDevBox. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetDevBox("", "", ""); +]]> +This sample shows how to call GetDevBox with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetDevBox("", "", ""); ]]> @@ -253,6 +367,44 @@ Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumbe Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString()); Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("localAdministrator").ToString()); +]]> + + + +This sample shows how to call GetRemoteConnectionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetRemoteConnectionAsync("", "", ""); +]]> +This sample shows how to call GetRemoteConnectionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetRemoteConnectionAsync("", "", ""); +]]> + + + +This sample shows how to call GetRemoteConnection. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetRemoteConnection("", "", ""); +]]> +This sample shows how to call GetRemoteConnection with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetRemoteConnection("", "", ""); ]]> @@ -305,6 +457,44 @@ Response response = client.GetRemoteConnection("", "", " + + + +This sample shows how to call GetDevBoxActionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetDevBoxActionAsync("", "", "", ""); +]]> +This sample shows how to call GetDevBoxActionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.GetDevBoxActionAsync("", "", "", ""); +]]> + + + +This sample shows how to call GetDevBoxAction. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetDevBoxAction("", "", "", ""); +]]> +This sample shows how to call GetDevBoxAction with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.GetDevBoxAction("", "", "", ""); ]]> @@ -413,6 +603,44 @@ DevBoxesClient client = new DevBoxesClient(endpoint, credential); Response response = client.SkipAction("", "", "", ""); Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DelayActionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.DelayActionAsync("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +]]> +This sample shows how to call DelayActionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = await client.DelayActionAsync("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +]]> + + + +This sample shows how to call DelayAction. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.DelayAction("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); +]]> +This sample shows how to call DelayAction with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Response response = client.DelayAction("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); ]]> @@ -477,7 +705,53 @@ Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); ]]> - + + +This sample shows how to call GetPoolsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxPool item in client.GetPoolsAsync("")) +{ +} +]]> +This sample shows how to call GetPoolsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxPool item in client.GetPoolsAsync("")) +{ +} +]]> + + + +This sample shows how to call GetPools. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxPool item in client.GetPools("")) +{ +} +]]> +This sample shows how to call GetPools with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxPool item in client.GetPools("")) +{ +} +]]> + + This sample shows how to call GetPoolsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetPoolsAsync("", null, null, null)) +await foreach (BinaryData item in client.GetPoolsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -499,7 +773,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetPoolsAsync("", "", 1234, null)) +await foreach (BinaryData item in client.GetPoolsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -522,7 +796,7 @@ await foreach (BinaryData item in client.GetPoolsAsync("", " - + This sample shows how to call GetPools and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetPools("", null, null, null)) +foreach (BinaryData item in client.GetPools("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -544,7 +818,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetPools("", "", 1234, null)) +foreach (BinaryData item in client.GetPools("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -567,7 +841,53 @@ foreach (BinaryData item in client.GetPools("", "", 1234, n } ]]> - + + +This sample shows how to call GetSchedulesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxSchedule item in client.GetSchedulesAsync("", "")) +{ +} +]]> +This sample shows how to call GetSchedulesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxSchedule item in client.GetSchedulesAsync("", "")) +{ +} +]]> + + + +This sample shows how to call GetSchedules. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxSchedule item in client.GetSchedules("", "")) +{ +} +]]> +This sample shows how to call GetSchedules with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxSchedule item in client.GetSchedules("", "")) +{ +} +]]> + + This sample shows how to call GetSchedulesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetSchedulesAsync("", "", null, null, null)) +await foreach (BinaryData item in client.GetSchedulesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -591,7 +911,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetSchedulesAsync("", "", "", 1234, null)) +await foreach (BinaryData item in client.GetSchedulesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -602,7 +922,7 @@ await foreach (BinaryData item in client.GetSchedulesAsync("", " - + This sample shows how to call GetSchedules and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetSchedules("", "", null, null, null)) +foreach (BinaryData item in client.GetSchedules("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -626,7 +946,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetSchedules("", "", "", 1234, null)) +foreach (BinaryData item in client.GetSchedules("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -637,7 +957,53 @@ foreach (BinaryData item in client.GetSchedules("", "", " } ]]> - + + +This sample shows how to call GetAllDevBoxesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetAllDevBoxesAsync()) +{ +} +]]> +This sample shows how to call GetAllDevBoxesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetAllDevBoxesAsync()) +{ +} +]]> + + + +This sample shows how to call GetAllDevBoxes. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetAllDevBoxes()) +{ +} +]]> +This sample shows how to call GetAllDevBoxes with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetAllDevBoxes()) +{ +} +]]> + + This sample shows how to call GetAllDevBoxesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllDevBoxesAsync(null, null, null)) +await foreach (BinaryData item in client.GetAllDevBoxesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -658,7 +1024,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllDevBoxesAsync("", 1234, null)) +await foreach (BinaryData item in client.GetAllDevBoxesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -690,7 +1056,7 @@ await foreach (BinaryData item in client.GetAllDevBoxesAsync("", 1234, n } ]]> - + This sample shows how to call GetAllDevBoxes and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetAllDevBoxes(null, null, null)) +foreach (BinaryData item in client.GetAllDevBoxes(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -711,7 +1077,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetAllDevBoxes("", 1234, null)) +foreach (BinaryData item in client.GetAllDevBoxes(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -743,7 +1109,53 @@ foreach (BinaryData item in client.GetAllDevBoxes("", 1234, null)) } ]]> - + + +This sample shows how to call GetAllDevBoxesByUserAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetAllDevBoxesByUserAsync("")) +{ +} +]]> +This sample shows how to call GetAllDevBoxesByUserAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetAllDevBoxesByUserAsync("")) +{ +} +]]> + + + +This sample shows how to call GetAllDevBoxesByUser. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetAllDevBoxesByUser("")) +{ +} +]]> +This sample shows how to call GetAllDevBoxesByUser with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetAllDevBoxesByUser("")) +{ +} +]]> + + This sample shows how to call GetAllDevBoxesByUserAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null, null, null)) +await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -764,7 +1176,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", "", 1234, null)) +await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -796,7 +1208,7 @@ await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", " } ]]> - + This sample shows how to call GetAllDevBoxesByUser and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetAllDevBoxesByUser("", null, null, null)) +foreach (BinaryData item in client.GetAllDevBoxesByUser("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -817,7 +1229,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetAllDevBoxesByUser("", "", 1234, null)) +foreach (BinaryData item in client.GetAllDevBoxesByUser("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -849,7 +1261,53 @@ foreach (BinaryData item in client.GetAllDevBoxesByUser("", "", } ]]> - + + +This sample shows how to call GetDevBoxesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetDevBoxesAsync("", "")) +{ +} +]]> +This sample shows how to call GetDevBoxesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBox item in client.GetDevBoxesAsync("", "")) +{ +} +]]> + + + +This sample shows how to call GetDevBoxes. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetDevBoxes("", "")) +{ +} +]]> +This sample shows how to call GetDevBoxes with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBox item in client.GetDevBoxes("", "")) +{ +} +]]> + + This sample shows how to call GetDevBoxesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null, null, null)) +await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -870,7 +1328,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetDevBoxesAsync("", "", "", 1234, null)) +await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -902,7 +1360,7 @@ await foreach (BinaryData item in client.GetDevBoxesAsync("", " - + This sample shows how to call GetDevBoxes and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetDevBoxes("", "", null, null, null)) +foreach (BinaryData item in client.GetDevBoxes("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -923,7 +1381,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetDevBoxes("", "", "", 1234, null)) +foreach (BinaryData item in client.GetDevBoxes("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -953,6 +1411,52 @@ foreach (BinaryData item in client.GetDevBoxes("", "", " + + + +This sample shows how to call GetDevBoxActionsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxAction item in client.GetDevBoxActionsAsync("", "", "")) +{ +} +]]> +This sample shows how to call GetDevBoxActionsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxAction item in client.GetDevBoxActionsAsync("", "", "")) +{ +} +]]> + + + +This sample shows how to call GetDevBoxActions. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxAction item in client.GetDevBoxActions("", "", "")) +{ +} +]]> +This sample shows how to call GetDevBoxActions with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxAction item in client.GetDevBoxActions("", "", "")) +{ +} ]]> @@ -1019,6 +1523,52 @@ foreach (BinaryData item in client.GetDevBoxActions("", "", Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } +]]> + + + +This sample shows how to call DelayAllActionsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxActionDelayResult item in client.DelayAllActionsAsync("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} +]]> +This sample shows how to call DelayAllActionsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (DevBoxActionDelayResult item in client.DelayAllActionsAsync("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} +]]> + + + +This sample shows how to call DelayAllActions. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxActionDelayResult item in client.DelayAllActions("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} +]]> +This sample shows how to call DelayAllActions with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (DevBoxActionDelayResult item in client.DelayAllActions("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} ]]> diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml index 3675c61c53c8..d043ea778f39 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml @@ -1,6 +1,44 @@ + + +This sample shows how to call GetProjectAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +Response response = await client.GetProjectAsync(""); +]]> +This sample shows how to call GetProjectAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +Response response = await client.GetProjectAsync(""); +]]> + + + +This sample shows how to call GetProject. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +Response response = client.GetProject(""); +]]> +This sample shows how to call GetProject with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +Response response = client.GetProject(""); +]]> + This sample shows how to call GetProjectAsync and parse the result. @@ -55,7 +93,53 @@ Console.WriteLine(result.GetProperty("description").ToString()); Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); ]]> - + + +This sample shows how to call GetProjectsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +await foreach (DevCenterProject item in client.GetProjectsAsync()) +{ +} +]]> +This sample shows how to call GetProjectsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +await foreach (DevCenterProject item in client.GetProjectsAsync()) +{ +} +]]> + + + +This sample shows how to call GetProjects. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +foreach (DevCenterProject item in client.GetProjects()) +{ +} +]]> +This sample shows how to call GetProjects with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevCenterClient client = new DevCenterClient(endpoint, credential); + +foreach (DevCenterProject item in client.GetProjects()) +{ +} +]]> + + This sample shows how to call GetProjectsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -await foreach (BinaryData item in client.GetProjectsAsync(null, null, null)) +await foreach (BinaryData item in client.GetProjectsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -75,7 +159,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -await foreach (BinaryData item in client.GetProjectsAsync("", 1234, null)) +await foreach (BinaryData item in client.GetProjectsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -84,7 +168,7 @@ await foreach (BinaryData item in client.GetProjectsAsync("", 1234, null } ]]> - + This sample shows how to call GetProjects and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -foreach (BinaryData item in client.GetProjects(null, null, null)) +foreach (BinaryData item in client.GetProjects(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -104,7 +188,7 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -foreach (BinaryData item in client.GetProjects("", 1234, null)) +foreach (BinaryData item in client.GetProjects(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..bdc58bf59af2 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingList.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..168968739dca --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Developer.DevCenter +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..8d0e48b43edb --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.Developer.DevCenter +{ + internal static class ModelSerializationExtensions + { + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + private static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Optional.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..4e7fb1f974ca --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Developer.DevCenter +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..2a97ef747d7b --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.Developer.DevCenter +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs new file mode 100644 index 000000000000..790e716273a5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.Serialization.cs @@ -0,0 +1,381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBox : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBox)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(ProjectName)) + { + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + } + writer.WritePropertyName("poolName"u8); + writer.WriteStringValue(PoolName); + if (options.Format != "W" && Optional.IsDefined(HibernateSupport)) + { + writer.WritePropertyName("hibernateSupport"u8); + writer.WriteStringValue(HibernateSupport.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ActionState)) + { + writer.WritePropertyName("actionState"u8); + writer.WriteStringValue(ActionState); + } + if (options.Format != "W" && Optional.IsDefined(PowerState)) + { + writer.WritePropertyName("powerState"u8); + writer.WriteStringValue(PowerState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(UniqueId)) + { + writer.WritePropertyName("uniqueId"u8); + writer.WriteStringValue(UniqueId.Value); + } + if (options.Format != "W" && Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (options.Format != "W" && Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(UserId)) + { + writer.WritePropertyName("user"u8); + writer.WriteStringValue(UserId.Value); + } + if (options.Format != "W" && Optional.IsDefined(HardwareProfile)) + { + writer.WritePropertyName("hardwareProfile"u8); + writer.WriteObjectValue(HardwareProfile); + } + if (options.Format != "W" && Optional.IsDefined(StorageProfile)) + { + writer.WritePropertyName("storageProfile"u8); + writer.WriteObjectValue(StorageProfile); + } + if (options.Format != "W" && Optional.IsDefined(ImageReference)) + { + writer.WritePropertyName("imageReference"u8); + writer.WriteObjectValue(ImageReference); + } + if (options.Format != "W" && Optional.IsDefined(CreatedTime)) + { + writer.WritePropertyName("createdTime"u8); + writer.WriteStringValue(CreatedTime.Value, "O"); + } + if (Optional.IsDefined(LocalAdministratorStatus)) + { + writer.WritePropertyName("localAdministrator"u8); + writer.WriteStringValue(LocalAdministratorStatus.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBox IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBox)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBox(document.RootElement, options); + } + + internal static DevBox DeserializeDevBox(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string projectName = default; + string poolName = default; + HibernateSupport? hibernateSupport = default; + DevBoxProvisioningState? provisioningState = default; + string actionState = default; + PowerState? powerState = default; + Guid? uniqueId = default; + ResponseError error = default; + AzureLocation? location = default; + DevBoxOSType? osType = default; + Guid? user = default; + DevBoxHardwareProfile hardwareProfile = default; + DevBoxStorageProfile storageProfile = default; + DevBoxImageReference imageReference = default; + DateTimeOffset? createdTime = default; + LocalAdministratorStatus? localAdministrator = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("poolName"u8)) + { + poolName = property.Value.GetString(); + continue; + } + if (property.NameEquals("hibernateSupport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hibernateSupport = new HibernateSupport(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DevBoxProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("actionState"u8)) + { + actionState = property.Value.GetString(); + continue; + } + if (property.NameEquals("powerState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + powerState = new PowerState(property.Value.GetString()); + continue; + } + if (property.NameEquals("uniqueId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uniqueId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("osType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osType = new DevBoxOSType(property.Value.GetString()); + continue; + } + if (property.NameEquals("user"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + user = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("hardwareProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = DevBoxHardwareProfile.DeserializeDevBoxHardwareProfile(property.Value, options); + continue; + } + if (property.NameEquals("storageProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = DevBoxStorageProfile.DeserializeDevBoxStorageProfile(property.Value, options); + continue; + } + if (property.NameEquals("imageReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageReference = DevBoxImageReference.DeserializeDevBoxImageReference(property.Value, options); + continue; + } + if (property.NameEquals("createdTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("localAdministrator"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localAdministrator = new LocalAdministratorStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBox( + name, + projectName, + poolName, + hibernateSupport, + provisioningState, + actionState, + powerState, + uniqueId, + error, + location, + osType, + user, + hardwareProfile, + storageProfile, + imageReference, + createdTime, + localAdministrator, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBox)} does not support '{options.Format}' format."); + } + } + + DevBox IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBox(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBox)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBox FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBox(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs new file mode 100644 index 000000000000..57e8e92069bb --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBox.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + /// A Dev Box. + public partial class DevBox + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Display name for the Dev Box. + /// Name of the project this Dev Box belongs to. + /// The name of the Dev Box pool this machine belongs to. + /// Indicates whether hibernate is enabled/disabled or unknown. + /// The current provisioning state of the Dev Box. + /// + /// The current action state of the Dev Box. This is state is based on previous + /// action performed by user. + /// + /// The current power state of the Dev Box. + /// + /// A unique identifier for the Dev Box. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + /// Provisioning or action error details. Populated only for error states. + /// + /// Azure region where this Dev Box is located. This will be the same region as the + /// Virtual Network it is attached to. + /// + /// The operating system type of this Dev Box. + /// The AAD object id of the user this Dev Box is assigned to. + /// Information about the Dev Box's hardware resources. + /// Storage settings for this Dev Box. + /// Information about the image used for this Dev Box. + /// Creation time of this Dev Box. + /// Indicates whether the owner of the Dev Box is a local administrator. + /// Keeps track of any properties unknown to the library. + internal DevBox(string name, string projectName, string poolName, HibernateSupport? hibernateSupport, DevBoxProvisioningState? provisioningState, string actionState, PowerState? powerState, Guid? uniqueId, ResponseError error, AzureLocation? location, DevBoxOSType? osType, Guid? userId, DevBoxHardwareProfile hardwareProfile, DevBoxStorageProfile storageProfile, DevBoxImageReference imageReference, DateTimeOffset? createdTime, LocalAdministratorStatus? localAdministratorStatus, IDictionary serializedAdditionalRawData) + { + Name = name; + ProjectName = projectName; + PoolName = poolName; + HibernateSupport = hibernateSupport; + ProvisioningState = provisioningState; + ActionState = actionState; + PowerState = powerState; + UniqueId = uniqueId; + Error = error; + Location = location; + OSType = osType; + UserId = userId; + HardwareProfile = hardwareProfile; + StorageProfile = storageProfile; + ImageReference = imageReference; + CreatedTime = createdTime; + LocalAdministratorStatus = localAdministratorStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBox() + { + } + + /// Display name for the Dev Box. + public string Name { get; } + /// Name of the project this Dev Box belongs to. + public string ProjectName { get; } + /// The name of the Dev Box pool this machine belongs to. + public string PoolName { get; set; } + /// Indicates whether hibernate is enabled/disabled or unknown. + public HibernateSupport? HibernateSupport { get; } + /// The current provisioning state of the Dev Box. + public DevBoxProvisioningState? ProvisioningState { get; } + /// + /// The current action state of the Dev Box. This is state is based on previous + /// action performed by user. + /// + public string ActionState { get; } + /// The current power state of the Dev Box. + public PowerState? PowerState { get; } + /// + /// A unique identifier for the Dev Box. This is a GUID-formatted string (e.g. + /// 00000000-0000-0000-0000-000000000000). + /// + public Guid? UniqueId { get; } + /// Provisioning or action error details. Populated only for error states. + public ResponseError Error { get; } + /// + /// Azure region where this Dev Box is located. This will be the same region as the + /// Virtual Network it is attached to. + /// + public AzureLocation? Location { get; } + /// The operating system type of this Dev Box. + public DevBoxOSType? OSType { get; } + /// The AAD object id of the user this Dev Box is assigned to. + public Guid? UserId { get; } + /// Information about the Dev Box's hardware resources. + public DevBoxHardwareProfile HardwareProfile { get; } + /// Storage settings for this Dev Box. + public DevBoxStorageProfile StorageProfile { get; } + /// Information about the image used for this Dev Box. + public DevBoxImageReference ImageReference { get; } + /// Creation time of this Dev Box. + public DateTimeOffset? CreatedTime { get; } + /// Indicates whether the owner of the Dev Box is a local administrator. + public LocalAdministratorStatus? LocalAdministratorStatus { get; set; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.Serialization.cs new file mode 100644 index 000000000000..6c516ed18518 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxAction)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("actionType"u8); + writer.WriteStringValue(ActionType.ToString()); + writer.WritePropertyName("sourceId"u8); + writer.WriteStringValue(SourceId); + if (Optional.IsDefined(SuspendedUntil)) + { + writer.WritePropertyName("suspendedUntil"u8); + writer.WriteStringValue(SuspendedUntil.Value, "O"); + } + if (Optional.IsDefined(NextAction)) + { + writer.WritePropertyName("next"u8); + writer.WriteObjectValue(NextAction); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxAction)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxAction(document.RootElement, options); + } + + internal static DevBoxAction DeserializeDevBoxAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + DevBoxActionType actionType = default; + string sourceId = default; + DateTimeOffset? suspendedUntil = default; + DevBoxNextAction next = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionType"u8)) + { + actionType = new DevBoxActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceId"u8)) + { + sourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("suspendedUntil"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + suspendedUntil = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("next"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + next = DevBoxNextAction.DeserializeDevBoxNextAction(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxAction( + name, + actionType, + sourceId, + suspendedUntil, + next, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxAction)} does not support '{options.Format}' format."); + } + } + + DevBoxAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxAction)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxAction(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs new file mode 100644 index 000000000000..c204cd48b228 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxAction.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// An action which will take place on a Dev Box. + public partial class DevBoxAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The action that will be taken. + /// The id of the resource which triggered this action. + /// is null. + internal DevBoxAction(DevBoxActionType actionType, string sourceId) + { + Argument.AssertNotNull(sourceId, nameof(sourceId)); + + ActionType = actionType; + SourceId = sourceId; + } + + /// Initializes a new instance of . + /// The name of the action. + /// The action that will be taken. + /// The id of the resource which triggered this action. + /// The earliest time that the action could occur (UTC). + /// Details about the next run of this action. + /// Keeps track of any properties unknown to the library. + internal DevBoxAction(string name, DevBoxActionType actionType, string sourceId, DateTimeOffset? suspendedUntil, DevBoxNextAction nextAction, IDictionary serializedAdditionalRawData) + { + Name = name; + ActionType = actionType; + SourceId = sourceId; + SuspendedUntil = suspendedUntil; + NextAction = nextAction; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBoxAction() + { + } + + /// The name of the action. + public string Name { get; } + /// The action that will be taken. + public DevBoxActionType ActionType { get; } + /// The id of the resource which triggered this action. + public string SourceId { get; } + /// The earliest time that the action could occur (UTC). + public DateTimeOffset? SuspendedUntil { get; } + /// Details about the next run of this action. + public DevBoxNextAction NextAction { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.Serialization.cs new file mode 100644 index 000000000000..bf691edd1820 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxActionDelayResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxActionDelayResult)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(ActionName); + writer.WritePropertyName("result"u8); + writer.WriteStringValue(DelayStatus.ToString()); + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxActionDelayResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxActionDelayResult)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxActionDelayResult(document.RootElement, options); + } + + internal static DevBoxActionDelayResult DeserializeDevBoxActionDelayResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + DevBoxActionDelayStatus result = default; + DevBoxAction action = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("result"u8)) + { + result = new DevBoxActionDelayStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = DevBoxAction.DeserializeDevBoxAction(property.Value, options); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxActionDelayResult(name, result, action, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxActionDelayResult)} does not support '{options.Format}' format."); + } + } + + DevBoxActionDelayResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxActionDelayResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxActionDelayResult)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxActionDelayResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxActionDelayResult(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.cs new file mode 100644 index 000000000000..0599af047a7e --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayResult.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// The action delay result. + public partial class DevBoxActionDelayResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the action. + /// The result of the delay operation on this action. + /// is null. + internal DevBoxActionDelayResult(string actionName, DevBoxActionDelayStatus delayStatus) + { + Argument.AssertNotNull(actionName, nameof(actionName)); + + ActionName = actionName; + DelayStatus = delayStatus; + } + + /// Initializes a new instance of . + /// The name of the action. + /// The result of the delay operation on this action. + /// The delayed action. + /// Information about the error that occurred. Only populated on error. + /// Keeps track of any properties unknown to the library. + internal DevBoxActionDelayResult(string actionName, DevBoxActionDelayStatus delayStatus, DevBoxAction action, ResponseError error, IDictionary serializedAdditionalRawData) + { + ActionName = actionName; + DelayStatus = delayStatus; + Action = action; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBoxActionDelayResult() + { + } + + /// The name of the action. + public string ActionName { get; } + /// The result of the delay operation on this action. + public DevBoxActionDelayStatus DelayStatus { get; } + /// The delayed action. + public DevBoxAction Action { get; } + /// Information about the error that occurred. Only populated on error. + public ResponseError Error { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayStatus.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayStatus.cs new file mode 100644 index 000000000000..7a20bb465fd3 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionDelayStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The result of the delay operation on this action. + public readonly partial struct DevBoxActionDelayStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevBoxActionDelayStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + + /// The delay operation succeeded. + public static DevBoxActionDelayStatus Succeeded { get; } = new DevBoxActionDelayStatus(SucceededValue); + /// The delay operation failed. + public static DevBoxActionDelayStatus Failed { get; } = new DevBoxActionDelayStatus(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(DevBoxActionDelayStatus left, DevBoxActionDelayStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevBoxActionDelayStatus left, DevBoxActionDelayStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DevBoxActionDelayStatus(string value) => new DevBoxActionDelayStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevBoxActionDelayStatus other && Equals(other); + /// + public bool Equals(DevBoxActionDelayStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionType.cs new file mode 100644 index 000000000000..9c803b113326 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxActionType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The type of action which will take place on a Dev Box. + public readonly partial struct DevBoxActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevBoxActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StopValue = "Stop"; + + /// The action will stop the Dev Box. + public static DevBoxActionType Stop { get; } = new DevBoxActionType(StopValue); + /// Determines if two values are the same. + public static bool operator ==(DevBoxActionType left, DevBoxActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevBoxActionType left, DevBoxActionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DevBoxActionType(string value) => new DevBoxActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevBoxActionType other && Equals(other); + /// + public bool Equals(DevBoxActionType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.Serialization.cs new file mode 100644 index 000000000000..cfdc43b47ea5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxHardwareProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxHardwareProfile)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(SkuName)) + { + writer.WritePropertyName("skuName"u8); + writer.WriteStringValue(SkuName.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(VCPUs)) + { + writer.WritePropertyName("vCPUs"u8); + writer.WriteNumberValue(VCPUs.Value); + } + if (options.Format != "W" && Optional.IsDefined(MemoryGB)) + { + writer.WritePropertyName("memoryGB"u8); + writer.WriteNumberValue(MemoryGB.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxHardwareProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxHardwareProfile)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxHardwareProfile(document.RootElement, options); + } + + internal static DevBoxHardwareProfile DeserializeDevBoxHardwareProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SkuName? skuName = default; + int? vcpUs = default; + int? memoryGB = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("skuName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + skuName = new SkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("vCPUs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + vcpUs = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("memoryGB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + memoryGB = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxHardwareProfile(skuName, vcpUs, memoryGB, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxHardwareProfile)} does not support '{options.Format}' format."); + } + } + + DevBoxHardwareProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxHardwareProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxHardwareProfile)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxHardwareProfile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxHardwareProfile(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.cs new file mode 100644 index 000000000000..e09e808a4e10 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxHardwareProfile.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Hardware specifications for the Dev Box. + public partial class DevBoxHardwareProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DevBoxHardwareProfile() + { + } + + /// Initializes a new instance of . + /// The name of the SKU. + /// The number of vCPUs available for the Dev Box. + /// The amount of memory available for the Dev Box. + /// Keeps track of any properties unknown to the library. + internal DevBoxHardwareProfile(SkuName? skuName, int? vcpUs, int? memoryGB, IDictionary serializedAdditionalRawData) + { + SkuName = skuName; + VCPUs = vcpUs; + MemoryGB = memoryGB; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the SKU. + public SkuName? SkuName { get; } + /// The number of vCPUs available for the Dev Box. + public int? VCPUs { get; } + /// The amount of memory available for the Dev Box. + public int? MemoryGB { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.Serialization.cs new file mode 100644 index 000000000000..ad30728e5ab6 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxImageReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxImageReference)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && Optional.IsDefined(OperatingSystem)) + { + writer.WritePropertyName("operatingSystem"u8); + writer.WriteStringValue(OperatingSystem); + } + if (options.Format != "W" && Optional.IsDefined(OSBuildNumber)) + { + writer.WritePropertyName("osBuildNumber"u8); + writer.WriteStringValue(OSBuildNumber); + } + if (options.Format != "W" && Optional.IsDefined(PublishedDate)) + { + writer.WritePropertyName("publishedDate"u8); + writer.WriteStringValue(PublishedDate.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxImageReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxImageReference)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxImageReference(document.RootElement, options); + } + + internal static DevBoxImageReference DeserializeDevBoxImageReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string version = default; + string operatingSystem = default; + string osBuildNumber = default; + DateTimeOffset? publishedDate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("operatingSystem"u8)) + { + operatingSystem = property.Value.GetString(); + continue; + } + if (property.NameEquals("osBuildNumber"u8)) + { + osBuildNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("publishedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publishedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxImageReference( + name, + version, + operatingSystem, + osBuildNumber, + publishedDate, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxImageReference)} does not support '{options.Format}' format."); + } + } + + DevBoxImageReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxImageReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxImageReference)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxImageReference FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxImageReference(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs new file mode 100644 index 000000000000..596dcb3dce32 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxImageReference.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Specifies information about the image used. + public partial class DevBoxImageReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DevBoxImageReference() + { + } + + /// Initializes a new instance of . + /// The name of the image used. + /// The version of the image. + /// The operating system of the image. + /// The operating system build number of the image. + /// The datetime that the backing image version was published. + /// Keeps track of any properties unknown to the library. + internal DevBoxImageReference(string name, string version, string operatingSystem, string osBuildNumber, DateTimeOffset? publishedDate, IDictionary serializedAdditionalRawData) + { + Name = name; + Version = version; + OperatingSystem = operatingSystem; + OSBuildNumber = osBuildNumber; + PublishedDate = publishedDate; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the image used. + public string Name { get; } + /// The version of the image. + public string Version { get; } + /// The operating system of the image. + public string OperatingSystem { get; } + /// The operating system build number of the image. + public string OSBuildNumber { get; } + /// The datetime that the backing image version was published. + public DateTimeOffset? PublishedDate { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.Serialization.cs new file mode 100644 index 000000000000..70990f1bcc72 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxNextAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxNextAction)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("scheduledTime"u8); + writer.WriteStringValue(ScheduledTime, "O"); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxNextAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxNextAction)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxNextAction(document.RootElement, options); + } + + internal static DevBoxNextAction DeserializeDevBoxNextAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset scheduledTime = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheduledTime"u8)) + { + scheduledTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxNextAction(scheduledTime, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxNextAction)} does not support '{options.Format}' format."); + } + } + + DevBoxNextAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxNextAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxNextAction)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxNextAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxNextAction(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs new file mode 100644 index 000000000000..7abeb1fff11c --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxNextAction.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Details about the next run of an action. + public partial class DevBoxNextAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The time the action will be triggered (UTC). + internal DevBoxNextAction(DateTimeOffset scheduledTime) + { + ScheduledTime = scheduledTime; + } + + /// Initializes a new instance of . + /// The time the action will be triggered (UTC). + /// Keeps track of any properties unknown to the library. + internal DevBoxNextAction(DateTimeOffset scheduledTime, IDictionary serializedAdditionalRawData) + { + ScheduledTime = scheduledTime; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBoxNextAction() + { + } + + /// The time the action will be triggered (UTC). + public DateTimeOffset ScheduledTime { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxOSType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxOSType.cs new file mode 100644 index 000000000000..6551ec749577 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxOSType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The operating system type. + public readonly partial struct DevBoxOSType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevBoxOSType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WindowsValue = "Windows"; + + /// The Windows operating system. + public static DevBoxOSType Windows { get; } = new DevBoxOSType(WindowsValue); + /// Determines if two values are the same. + public static bool operator ==(DevBoxOSType left, DevBoxOSType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevBoxOSType left, DevBoxOSType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DevBoxOSType(string value) => new DevBoxOSType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevBoxOSType other && Equals(other); + /// + public bool Equals(DevBoxOSType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.Serialization.cs new file mode 100644 index 000000000000..1aadacd6663b --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.Serialization.cs @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxPool : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxPool)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsDefined(OSType)) + { + writer.WritePropertyName("osType"u8); + writer.WriteStringValue(OSType.Value.ToString()); + } + if (Optional.IsDefined(HardwareProfile)) + { + writer.WritePropertyName("hardwareProfile"u8); + writer.WriteObjectValue(HardwareProfile); + } + if (Optional.IsDefined(HibernateSupport)) + { + writer.WritePropertyName("hibernateSupport"u8); + writer.WriteStringValue(HibernateSupport.Value.ToString()); + } + if (Optional.IsDefined(StorageProfile)) + { + writer.WritePropertyName("storageProfile"u8); + writer.WriteObjectValue(StorageProfile); + } + if (Optional.IsDefined(ImageReference)) + { + writer.WritePropertyName("imageReference"u8); + writer.WriteObjectValue(ImageReference); + } + if (Optional.IsDefined(LocalAdministratorStatus)) + { + writer.WritePropertyName("localAdministrator"u8); + writer.WriteStringValue(LocalAdministratorStatus.Value.ToString()); + } + if (Optional.IsDefined(StopOnDisconnect)) + { + writer.WritePropertyName("stopOnDisconnect"u8); + writer.WriteObjectValue(StopOnDisconnect); + } + writer.WritePropertyName("healthStatus"u8); + writer.WriteStringValue(HealthStatus.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxPool IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxPool)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxPool(document.RootElement, options); + } + + internal static DevBoxPool DeserializeDevBoxPool(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + AzureLocation location = default; + DevBoxOSType? osType = default; + DevBoxHardwareProfile hardwareProfile = default; + HibernateSupport? hibernateSupport = default; + DevBoxStorageProfile storageProfile = default; + DevBoxImageReference imageReference = default; + LocalAdministratorStatus? localAdministrator = default; + StopOnDisconnectConfiguration stopOnDisconnect = default; + PoolHealthStatus healthStatus = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("osType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osType = new DevBoxOSType(property.Value.GetString()); + continue; + } + if (property.NameEquals("hardwareProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hardwareProfile = DevBoxHardwareProfile.DeserializeDevBoxHardwareProfile(property.Value, options); + continue; + } + if (property.NameEquals("hibernateSupport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hibernateSupport = new HibernateSupport(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageProfile = DevBoxStorageProfile.DeserializeDevBoxStorageProfile(property.Value, options); + continue; + } + if (property.NameEquals("imageReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + imageReference = DevBoxImageReference.DeserializeDevBoxImageReference(property.Value, options); + continue; + } + if (property.NameEquals("localAdministrator"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + localAdministrator = new LocalAdministratorStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("stopOnDisconnect"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stopOnDisconnect = StopOnDisconnectConfiguration.DeserializeStopOnDisconnectConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("healthStatus"u8)) + { + healthStatus = new PoolHealthStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxPool( + name, + location, + osType, + hardwareProfile, + hibernateSupport, + storageProfile, + imageReference, + localAdministrator, + stopOnDisconnect, + healthStatus, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxPool)} does not support '{options.Format}' format."); + } + } + + DevBoxPool IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxPool(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxPool)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxPool FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxPool(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.cs new file mode 100644 index 000000000000..49e7407f7889 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxPool.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + /// A pool of Dev Boxes. + public partial class DevBoxPool + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Azure region where Dev Boxes in the pool are located. + /// + /// Overall health status of the Pool. Indicates whether or not the Pool is + /// available to create Dev Boxes. + /// + internal DevBoxPool(AzureLocation location, PoolHealthStatus healthStatus) + { + Location = location; + HealthStatus = healthStatus; + } + + /// Initializes a new instance of . + /// Pool name. + /// Azure region where Dev Boxes in the pool are located. + /// The operating system type of Dev Boxes in this pool. + /// Hardware settings for the Dev Boxes created in this pool. + /// Indicates whether hibernate is enabled/disabled or unknown. + /// Storage settings for Dev Box created in this pool. + /// Image settings for Dev Boxes create in this pool. + /// + /// Indicates whether owners of Dev Boxes in this pool are local administrators on + /// the Dev Boxes. + /// + /// Stop on disconnect configuration settings for Dev Boxes created in this pool. + /// + /// Overall health status of the Pool. Indicates whether or not the Pool is + /// available to create Dev Boxes. + /// + /// Keeps track of any properties unknown to the library. + internal DevBoxPool(string name, AzureLocation location, DevBoxOSType? osType, DevBoxHardwareProfile hardwareProfile, HibernateSupport? hibernateSupport, DevBoxStorageProfile storageProfile, DevBoxImageReference imageReference, LocalAdministratorStatus? localAdministratorStatus, StopOnDisconnectConfiguration stopOnDisconnect, PoolHealthStatus healthStatus, IDictionary serializedAdditionalRawData) + { + Name = name; + Location = location; + OSType = osType; + HardwareProfile = hardwareProfile; + HibernateSupport = hibernateSupport; + StorageProfile = storageProfile; + ImageReference = imageReference; + LocalAdministratorStatus = localAdministratorStatus; + StopOnDisconnect = stopOnDisconnect; + HealthStatus = healthStatus; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBoxPool() + { + } + + /// Pool name. + public string Name { get; } + /// Azure region where Dev Boxes in the pool are located. + public AzureLocation Location { get; } + /// The operating system type of Dev Boxes in this pool. + public DevBoxOSType? OSType { get; } + /// Hardware settings for the Dev Boxes created in this pool. + public DevBoxHardwareProfile HardwareProfile { get; } + /// Indicates whether hibernate is enabled/disabled or unknown. + public HibernateSupport? HibernateSupport { get; } + /// Storage settings for Dev Box created in this pool. + public DevBoxStorageProfile StorageProfile { get; } + /// Image settings for Dev Boxes create in this pool. + public DevBoxImageReference ImageReference { get; } + /// + /// Indicates whether owners of Dev Boxes in this pool are local administrators on + /// the Dev Boxes. + /// + public LocalAdministratorStatus? LocalAdministratorStatus { get; } + /// Stop on disconnect configuration settings for Dev Boxes created in this pool. + public StopOnDisconnectConfiguration StopOnDisconnect { get; } + /// + /// Overall health status of the Pool. Indicates whether or not the Pool is + /// available to create Dev Boxes. + /// + public PoolHealthStatus HealthStatus { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxProvisioningState.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxProvisioningState.cs new file mode 100644 index 000000000000..4292581bb751 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxProvisioningState.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates the provisioning state of the Dev Box. + public readonly partial struct DevBoxProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevBoxProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + private const string StartingValue = "Starting"; + private const string StoppingValue = "Stopping"; + private const string ProvisioningValue = "Provisioning"; + private const string ProvisionedWithWarningValue = "ProvisionedWithWarning"; + private const string InGracePeriodValue = "InGracePeriod"; + private const string NotProvisionedValue = "NotProvisioned"; + + /// Dev Box was successfully provisioned. + public static DevBoxProvisioningState Succeeded { get; } = new DevBoxProvisioningState(SucceededValue); + /// Dev Box failed to provision. + public static DevBoxProvisioningState Failed { get; } = new DevBoxProvisioningState(FailedValue); + /// Dev Box provision was canceled. + public static DevBoxProvisioningState Canceled { get; } = new DevBoxProvisioningState(CanceledValue); + /// Dev Box is being created. + public static DevBoxProvisioningState Creating { get; } = new DevBoxProvisioningState(CreatingValue); + /// Dev Box is being deleted. + public static DevBoxProvisioningState Deleting { get; } = new DevBoxProvisioningState(DeletingValue); + /// Dev Box is updating. + public static DevBoxProvisioningState Updating { get; } = new DevBoxProvisioningState(UpdatingValue); + /// Dev Box is starting. + public static DevBoxProvisioningState Starting { get; } = new DevBoxProvisioningState(StartingValue); + /// Dev Box is stopping. + public static DevBoxProvisioningState Stopping { get; } = new DevBoxProvisioningState(StoppingValue); + /// Dev Box is provisioning. + public static DevBoxProvisioningState Provisioning { get; } = new DevBoxProvisioningState(ProvisioningValue); + /// Dev Box was provisioned with warning. + public static DevBoxProvisioningState ProvisionedWithWarning { get; } = new DevBoxProvisioningState(ProvisionedWithWarningValue); + /// Dev Box is in grace period. + public static DevBoxProvisioningState InGracePeriod { get; } = new DevBoxProvisioningState(InGracePeriodValue); + /// Dev Box is not provisioned. + public static DevBoxProvisioningState NotProvisioned { get; } = new DevBoxProvisioningState(NotProvisionedValue); + /// Determines if two values are the same. + public static bool operator ==(DevBoxProvisioningState left, DevBoxProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevBoxProvisioningState left, DevBoxProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DevBoxProvisioningState(string value) => new DevBoxProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevBoxProvisioningState other && Equals(other); + /// + public bool Equals(DevBoxProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.Serialization.cs new file mode 100644 index 000000000000..e1230f9ac8e2 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxSchedule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxSchedule)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ScheduleType.ToString()); + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(ScheduleFrequency.ToString()); + writer.WritePropertyName("time"u8); + writer.WriteStringValue(Time); + writer.WritePropertyName("timeZone"u8); + writer.WriteStringValue(TimeZone); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxSchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxSchedule)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxSchedule(document.RootElement, options); + } + + internal static DevBoxSchedule DeserializeDevBoxSchedule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ScheduleType type = default; + ScheduleFrequency frequency = default; + string time = default; + string timeZone = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ScheduleType(property.Value.GetString()); + continue; + } + if (property.NameEquals("frequency"u8)) + { + frequency = new ScheduleFrequency(property.Value.GetString()); + continue; + } + if (property.NameEquals("time"u8)) + { + time = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeZone"u8)) + { + timeZone = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxSchedule( + name, + type, + frequency, + time, + timeZone, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxSchedule)} does not support '{options.Format}' format."); + } + } + + DevBoxSchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxSchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxSchedule)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxSchedule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxSchedule(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.cs new file mode 100644 index 000000000000..3faeeb889f70 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxSchedule.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// A Schedule to execute action. + public partial class DevBoxSchedule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Supported type this scheduled task represents. + /// The frequency of this scheduled task. + /// The target time to trigger the action. The format is HH:MM. + /// The IANA timezone id at which the schedule should execute. + /// or is null. + internal DevBoxSchedule(ScheduleType scheduleType, ScheduleFrequency scheduleFrequency, string time, string timeZone) + { + Argument.AssertNotNull(time, nameof(time)); + Argument.AssertNotNull(timeZone, nameof(timeZone)); + + ScheduleType = scheduleType; + ScheduleFrequency = scheduleFrequency; + Time = time; + TimeZone = timeZone; + } + + /// Initializes a new instance of . + /// Display name for the Schedule. + /// Supported type this scheduled task represents. + /// The frequency of this scheduled task. + /// The target time to trigger the action. The format is HH:MM. + /// The IANA timezone id at which the schedule should execute. + /// Keeps track of any properties unknown to the library. + internal DevBoxSchedule(string name, ScheduleType scheduleType, ScheduleFrequency scheduleFrequency, string time, string timeZone, IDictionary serializedAdditionalRawData) + { + Name = name; + ScheduleType = scheduleType; + ScheduleFrequency = scheduleFrequency; + Time = time; + TimeZone = timeZone; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevBoxSchedule() + { + } + + /// Display name for the Schedule. + public string Name { get; } + /// Supported type this scheduled task represents. + public ScheduleType ScheduleType { get; } + /// The frequency of this scheduled task. + public ScheduleFrequency ScheduleFrequency { get; } + /// The target time to trigger the action. The format is HH:MM. + public string Time { get; } + /// The IANA timezone id at which the schedule should execute. + public string TimeZone { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.Serialization.cs new file mode 100644 index 000000000000..dceeed2aaf1a --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevBoxStorageProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxStorageProfile)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(OSDisk)) + { + writer.WritePropertyName("osDisk"u8); + writer.WriteObjectValue(OSDisk); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevBoxStorageProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevBoxStorageProfile)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevBoxStorageProfile(document.RootElement, options); + } + + internal static DevBoxStorageProfile DeserializeDevBoxStorageProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OSDisk osDisk = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("osDisk"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + osDisk = OSDisk.DeserializeOSDisk(property.Value, options); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevBoxStorageProfile(osDisk, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevBoxStorageProfile)} does not support '{options.Format}' format."); + } + } + + DevBoxStorageProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevBoxStorageProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevBoxStorageProfile)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevBoxStorageProfile FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevBoxStorageProfile(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.cs new file mode 100644 index 000000000000..241b2d6ba63d --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevBoxStorageProfile.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Storage settings for the Dev Box's disks. + public partial class DevBoxStorageProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DevBoxStorageProfile() + { + } + + /// Initializes a new instance of . + /// Settings for the operating system disk. + /// Keeps track of any properties unknown to the library. + internal DevBoxStorageProfile(OSDisk osDisk, IDictionary serializedAdditionalRawData) + { + OSDisk = osDisk; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Settings for the operating system disk. + public OSDisk OSDisk { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.Serialization.cs new file mode 100644 index 000000000000..88c08def8ad5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevCenterCatalog : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterCatalog)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevCenterCatalog IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterCatalog)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevCenterCatalog(document.RootElement, options); + } + + internal static DevCenterCatalog DeserializeDevCenterCatalog(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevCenterCatalog(name, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevCenterCatalog)} does not support '{options.Format}' format."); + } + } + + DevCenterCatalog IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevCenterCatalog(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevCenterCatalog)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevCenterCatalog FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevCenterCatalog(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.cs new file mode 100644 index 000000000000..fb81f7110604 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterCatalog.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// A catalog. + public partial class DevCenterCatalog + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DevCenterCatalog() + { + } + + /// Initializes a new instance of . + /// Name of the catalog. + /// Keeps track of any properties unknown to the library. + internal DevCenterCatalog(string name, IDictionary serializedAdditionalRawData) + { + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the catalog. + public string Name { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.Serialization.cs new file mode 100644 index 000000000000..80920769cfe5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.Serialization.cs @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevCenterEnvironment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterEnvironment)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartObject(); + foreach (var item in Parameters) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("environmentType"u8); + writer.WriteStringValue(EnvironmentTypeName); + if (options.Format != "W" && Optional.IsDefined(UserId)) + { + writer.WritePropertyName("user"u8); + writer.WriteStringValue(UserId.Value); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ResourceGroupId)) + { + writer.WritePropertyName("resourceGroupId"u8); + writer.WriteStringValue(ResourceGroupId); + } + writer.WritePropertyName("catalogName"u8); + writer.WriteStringValue(CatalogName); + writer.WritePropertyName("environmentDefinitionName"u8); + writer.WriteStringValue(EnvironmentDefinitionName); + if (options.Format != "W" && Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevCenterEnvironment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterEnvironment)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevCenterEnvironment(document.RootElement, options); + } + + internal static DevCenterEnvironment DeserializeDevCenterEnvironment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary parameters = default; + string name = default; + string environmentType = default; + Guid? user = default; + EnvironmentProvisioningState? provisioningState = default; + ResourceIdentifier resourceGroupId = default; + string catalogName = default; + string environmentDefinitionName = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + parameters = dictionary; + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("environmentType"u8)) + { + environmentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("user"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + user = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new EnvironmentProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceGroupId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceGroupId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("catalogName"u8)) + { + catalogName = property.Value.GetString(); + continue; + } + if (property.NameEquals("environmentDefinitionName"u8)) + { + environmentDefinitionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevCenterEnvironment( + parameters ?? new ChangeTrackingDictionary(), + name, + environmentType, + user, + provisioningState, + resourceGroupId, + catalogName, + environmentDefinitionName, + error, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevCenterEnvironment)} does not support '{options.Format}' format."); + } + } + + DevCenterEnvironment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevCenterEnvironment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevCenterEnvironment)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevCenterEnvironment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevCenterEnvironment(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.cs new file mode 100644 index 000000000000..77643ade5236 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironment.cs @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + /// Properties of an environment. + public partial class DevCenterEnvironment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Parameters object for the environment. + /// Environment name. + /// Environment type. + /// The AAD object id of the owner of this Environment. + /// The provisioning state of the environment. + /// The identifier of the resource group containing the environment's resources. + /// Name of the catalog. + /// Name of the environment definition. + /// Provisioning error details. Populated only for error states. + /// Keeps track of any properties unknown to the library. + internal DevCenterEnvironment(IDictionary parameters, string name, string environmentTypeName, Guid? userId, EnvironmentProvisioningState? provisioningState, ResourceIdentifier resourceGroupId, string catalogName, string environmentDefinitionName, ResponseError error, IDictionary serializedAdditionalRawData) + { + Parameters = parameters; + Name = name; + EnvironmentTypeName = environmentTypeName; + UserId = userId; + ProvisioningState = provisioningState; + ResourceGroupId = resourceGroupId; + CatalogName = catalogName; + EnvironmentDefinitionName = environmentDefinitionName; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevCenterEnvironment() + { + } + + /// + /// Parameters object for the environment. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary Parameters { get; } + /// Environment name. + public string Name { get; } + /// Environment type. + public string EnvironmentTypeName { get; set; } + /// The AAD object id of the owner of this Environment. + public Guid? UserId { get; } + /// The provisioning state of the environment. + public EnvironmentProvisioningState? ProvisioningState { get; } + /// Name of the catalog. + public string CatalogName { get; set; } + /// Name of the environment definition. + public string EnvironmentDefinitionName { get; set; } + /// Provisioning error details. Populated only for error states. + public ResponseError Error { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs new file mode 100644 index 000000000000..96644918ed98 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevCenterEnvironmentType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterEnvironmentType)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("deploymentTargetId"u8); + writer.WriteStringValue(DeploymentTargetId); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevCenterEnvironmentType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterEnvironmentType)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevCenterEnvironmentType(document.RootElement, options); + } + + internal static DevCenterEnvironmentType DeserializeDevCenterEnvironmentType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + ResourceIdentifier deploymentTargetId = default; + EnvironmentTypeStatus status = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentTargetId"u8)) + { + deploymentTargetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new EnvironmentTypeStatus(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevCenterEnvironmentType(name, deploymentTargetId, status, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevCenterEnvironmentType)} does not support '{options.Format}' format."); + } + } + + DevCenterEnvironmentType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevCenterEnvironmentType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevCenterEnvironmentType)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevCenterEnvironmentType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevCenterEnvironmentType(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs new file mode 100644 index 000000000000..a9d9a7bb8d38 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterEnvironmentType.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + /// Properties of an environment type. + public partial class DevCenterEnvironmentType + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the environment type. + /// + /// Id of a subscription or management group that the environment type will be + /// mapped to. The environment's resources will be deployed into this subscription + /// or management group. + /// + /// Indicates whether this environment type is enabled for use in this project. + /// or is null. + internal DevCenterEnvironmentType(string name, ResourceIdentifier deploymentTargetId, EnvironmentTypeStatus status) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(deploymentTargetId, nameof(deploymentTargetId)); + + Name = name; + DeploymentTargetId = deploymentTargetId; + Status = status; + } + + /// Initializes a new instance of . + /// Name of the environment type. + /// + /// Id of a subscription or management group that the environment type will be + /// mapped to. The environment's resources will be deployed into this subscription + /// or management group. + /// + /// Indicates whether this environment type is enabled for use in this project. + /// Keeps track of any properties unknown to the library. + internal DevCenterEnvironmentType(string name, ResourceIdentifier deploymentTargetId, EnvironmentTypeStatus status, IDictionary serializedAdditionalRawData) + { + Name = name; + DeploymentTargetId = deploymentTargetId; + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DevCenterEnvironmentType() + { + } + + /// Name of the environment type. + public string Name { get; } + /// Indicates whether this environment type is enabled for use in this project. + public EnvironmentTypeStatus Status { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.Serialization.cs new file mode 100644 index 000000000000..dfd3ce1e6feb --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class DevCenterProject : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterProject)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(MaxDevBoxesPerUser)) + { + writer.WritePropertyName("maxDevBoxesPerUser"u8); + writer.WriteNumberValue(MaxDevBoxesPerUser.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DevCenterProject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DevCenterProject)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDevCenterProject(document.RootElement, options); + } + + internal static DevCenterProject DeserializeDevCenterProject(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string description = default; + int? maxDevBoxesPerUser = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxDevBoxesPerUser"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxDevBoxesPerUser = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new DevCenterProject(name, description, maxDevBoxesPerUser, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DevCenterProject)} does not support '{options.Format}' format."); + } + } + + DevCenterProject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDevCenterProject(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DevCenterProject)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DevCenterProject FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDevCenterProject(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.cs new file mode 100644 index 000000000000..cc463de048dc --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/DevCenterProject.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Project details. + public partial class DevCenterProject + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DevCenterProject() + { + } + + /// Initializes a new instance of . + /// Name of the project. + /// Description of the project. + /// + /// When specified, indicates the maximum number of Dev Boxes a single user can + /// create across all pools in the project. + /// + /// Keeps track of any properties unknown to the library. + internal DevCenterProject(string name, string description, int? maxDevBoxesPerUser, IDictionary serializedAdditionalRawData) + { + Name = name; + Description = description; + MaxDevBoxesPerUser = maxDevBoxesPerUser; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the project. + public string Name { get; } + /// Description of the project. + public string Description { get; } + /// + /// When specified, indicates the maximum number of Dev Boxes a single user can + /// create across all pools in the project. + /// + public int? MaxDevBoxesPerUser { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.Serialization.cs new file mode 100644 index 000000000000..edb81f1dcb5b --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.Serialization.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class EnvironmentDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentDefinition)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("catalogName"u8); + writer.WriteStringValue(CatalogName); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ParametersSchema)) + { + writer.WritePropertyName("parametersSchema"u8); + writer.WriteStringValue(ParametersSchema); + } + if (Optional.IsDefined(TemplatePath)) + { + writer.WritePropertyName("templatePath"u8); + writer.WriteStringValue(TemplatePath); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EnvironmentDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentDefinition)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentDefinition(document.RootElement, options); + } + + internal static EnvironmentDefinition DeserializeEnvironmentDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string catalogName = default; + string description = default; + IReadOnlyList parameters = default; + string parametersSchema = default; + string templatePath = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("catalogName"u8)) + { + catalogName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EnvironmentDefinitionParameter.DeserializeEnvironmentDefinitionParameter(item, options)); + } + parameters = array; + continue; + } + if (property.NameEquals("parametersSchema"u8)) + { + parametersSchema = property.Value.GetString(); + continue; + } + if (property.NameEquals("templatePath"u8)) + { + templatePath = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new EnvironmentDefinition( + id, + name, + catalogName, + description, + parameters ?? new ChangeTrackingList(), + parametersSchema, + templatePath, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EnvironmentDefinition)} does not support '{options.Format}' format."); + } + } + + EnvironmentDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEnvironmentDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EnvironmentDefinition)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EnvironmentDefinition FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEnvironmentDefinition(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.cs new file mode 100644 index 000000000000..0e32a5cb2c51 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinition.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// An environment definition. + public partial class EnvironmentDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the environment definition. + /// Name of the catalog. + /// or is null. + internal EnvironmentDefinition(string id, string catalogName) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(catalogName, nameof(catalogName)); + + Id = id; + CatalogName = catalogName; + Parameters = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The ID of the environment definition. + /// Name of the environment definition. + /// Name of the catalog. + /// A short description of the environment definition. + /// Input parameters passed to an environment. + /// JSON schema defining the parameters object passed to an environment. + /// Path to the Environment Definition entrypoint file. + /// Keeps track of any properties unknown to the library. + internal EnvironmentDefinition(string id, string name, string catalogName, string description, IReadOnlyList parameters, string parametersSchema, string templatePath, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + CatalogName = catalogName; + Description = description; + Parameters = parameters; + ParametersSchema = parametersSchema; + TemplatePath = templatePath; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EnvironmentDefinition() + { + } + + /// The ID of the environment definition. + public string Id { get; } + /// Name of the environment definition. + public string Name { get; } + /// Name of the catalog. + public string CatalogName { get; } + /// A short description of the environment definition. + public string Description { get; } + /// Input parameters passed to an environment. + public IReadOnlyList Parameters { get; } + /// JSON schema defining the parameters object passed to an environment. + public string ParametersSchema { get; } + /// Path to the Environment Definition entrypoint file. + public string TemplatePath { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.Serialization.cs new file mode 100644 index 000000000000..9f747d907fef --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class EnvironmentDefinitionParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentDefinitionParameter)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DefaultValue)) + { + writer.WritePropertyName("default"u8); + writer.WriteStringValue(DefaultValue); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ParameterType.ToString()); + if (Optional.IsDefined(ReadOnly)) + { + writer.WritePropertyName("readOnly"u8); + writer.WriteBooleanValue(ReadOnly.Value); + } + writer.WritePropertyName("required"u8); + writer.WriteBooleanValue(Required); + if (Optional.IsCollectionDefined(Allowed)) + { + writer.WritePropertyName("allowed"u8); + writer.WriteStartArray(); + foreach (var item in Allowed) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EnvironmentDefinitionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentDefinitionParameter)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentDefinitionParameter(document.RootElement, options); + } + + internal static EnvironmentDefinitionParameter DeserializeEnvironmentDefinitionParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string description = default; + string @default = default; + EnvironmentDefinitionParameterType type = default; + bool? readOnly = default; + bool required = default; + IReadOnlyList allowed = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("default"u8)) + { + @default = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new EnvironmentDefinitionParameterType(property.Value.GetString()); + continue; + } + if (property.NameEquals("readOnly"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readOnly = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("required"u8)) + { + required = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("allowed"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowed = array; + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new EnvironmentDefinitionParameter( + id, + name, + description, + @default, + type, + readOnly, + required, + allowed ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EnvironmentDefinitionParameter)} does not support '{options.Format}' format."); + } + } + + EnvironmentDefinitionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEnvironmentDefinitionParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EnvironmentDefinitionParameter)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EnvironmentDefinitionParameter FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEnvironmentDefinitionParameter(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs new file mode 100644 index 000000000000..c67ea98e4a76 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameter.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Properties of an Environment Definition parameter. + public partial class EnvironmentDefinitionParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique ID of the parameter. + /// + /// A string of one of the basic JSON types (number, integer, array, object, + /// boolean, string) + /// + /// Whether or not this parameter is required. + /// is null. + internal EnvironmentDefinitionParameter(string id, EnvironmentDefinitionParameterType parameterType, bool required) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + ParameterType = parameterType; + Required = required; + Allowed = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Unique ID of the parameter. + /// Display name of the parameter. + /// Description of the parameter. + /// Default value of the parameter. + /// + /// A string of one of the basic JSON types (number, integer, array, object, + /// boolean, string) + /// + /// + /// Whether or not this parameter is read-only. If true, default should have a + /// value. + /// + /// Whether or not this parameter is required. + /// An array of allowed values. + /// Keeps track of any properties unknown to the library. + internal EnvironmentDefinitionParameter(string id, string name, string description, string defaultValue, EnvironmentDefinitionParameterType parameterType, bool? readOnly, bool required, IReadOnlyList allowed, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + Description = description; + DefaultValue = defaultValue; + ParameterType = parameterType; + ReadOnly = readOnly; + Required = required; + Allowed = allowed; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EnvironmentDefinitionParameter() + { + } + + /// Unique ID of the parameter. + public string Id { get; } + /// Display name of the parameter. + public string Name { get; } + /// Description of the parameter. + public string Description { get; } + /// Default value of the parameter. + public string DefaultValue { get; } + /// + /// A string of one of the basic JSON types (number, integer, array, object, + /// boolean, string) + /// + public EnvironmentDefinitionParameterType ParameterType { get; } + /// + /// Whether or not this parameter is read-only. If true, default should have a + /// value. + /// + public bool? ReadOnly { get; } + /// Whether or not this parameter is required. + public bool Required { get; } + /// An array of allowed values. + public IReadOnlyList Allowed { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameterType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameterType.cs new file mode 100644 index 000000000000..fce1e7a09241 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentDefinitionParameterType.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The type of data a parameter accepts. + public readonly partial struct EnvironmentDefinitionParameterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EnvironmentDefinitionParameterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ArrayValue = "array"; + private const string BooleanValue = "boolean"; + private const string IntegerValue = "integer"; + private const string NumberValue = "number"; + private const string ObjectValue = "object"; + private const string StringValue = "string"; + + /// The parameter accepts an array of values. + public static EnvironmentDefinitionParameterType Array { get; } = new EnvironmentDefinitionParameterType(ArrayValue); + /// The parameter accepts a boolean value. + public static EnvironmentDefinitionParameterType Boolean { get; } = new EnvironmentDefinitionParameterType(BooleanValue); + /// The parameter accepts an integer value. + public static EnvironmentDefinitionParameterType Integer { get; } = new EnvironmentDefinitionParameterType(IntegerValue); + /// The parameter accepts a number value. + public static EnvironmentDefinitionParameterType Number { get; } = new EnvironmentDefinitionParameterType(NumberValue); + /// The parameter accepts an object value. + public static EnvironmentDefinitionParameterType Object { get; } = new EnvironmentDefinitionParameterType(ObjectValue); + /// The parameter accepts a string value. + public static EnvironmentDefinitionParameterType String { get; } = new EnvironmentDefinitionParameterType(StringValue); + /// Determines if two values are the same. + public static bool operator ==(EnvironmentDefinitionParameterType left, EnvironmentDefinitionParameterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnvironmentDefinitionParameterType left, EnvironmentDefinitionParameterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EnvironmentDefinitionParameterType(string value) => new EnvironmentDefinitionParameterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnvironmentDefinitionParameterType other && Equals(other); + /// + public bool Equals(EnvironmentDefinitionParameterType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentProvisioningState.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentProvisioningState.cs new file mode 100644 index 000000000000..ac6722b6de56 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentProvisioningState.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The provisioning state of the environment. + public readonly partial struct EnvironmentProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EnvironmentProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; + private const string AcceptedValue = "Accepted"; + private const string DeletingValue = "Deleting"; + private const string UpdatingValue = "Updating"; + private const string PreparingValue = "Preparing"; + private const string RunningValue = "Running"; + private const string SyncingValue = "Syncing"; + private const string MovingResourcesValue = "MovingResources"; + private const string TransientFailureValue = "TransientFailure"; + private const string StorageProvisioningFailedValue = "StorageProvisioningFailed"; + + /// The environment was successfully provisioned. + public static EnvironmentProvisioningState Succeeded { get; } = new EnvironmentProvisioningState(SucceededValue); + /// The environment failed to provision. + public static EnvironmentProvisioningState Failed { get; } = new EnvironmentProvisioningState(FailedValue); + /// The environment provisioning was canceled. + public static EnvironmentProvisioningState Canceled { get; } = new EnvironmentProvisioningState(CanceledValue); + /// The environment is creating. + public static EnvironmentProvisioningState Creating { get; } = new EnvironmentProvisioningState(CreatingValue); + /// The environment was accepted. + public static EnvironmentProvisioningState Accepted { get; } = new EnvironmentProvisioningState(AcceptedValue); + /// The environment is deleting. + public static EnvironmentProvisioningState Deleting { get; } = new EnvironmentProvisioningState(DeletingValue); + /// The environment is updating. + public static EnvironmentProvisioningState Updating { get; } = new EnvironmentProvisioningState(UpdatingValue); + /// The environment is preparing. + public static EnvironmentProvisioningState Preparing { get; } = new EnvironmentProvisioningState(PreparingValue); + /// The environment is running. + public static EnvironmentProvisioningState Running { get; } = new EnvironmentProvisioningState(RunningValue); + /// The environment is Syncing. + public static EnvironmentProvisioningState Syncing { get; } = new EnvironmentProvisioningState(SyncingValue); + /// The environment is moving resources. + public static EnvironmentProvisioningState MovingResources { get; } = new EnvironmentProvisioningState(MovingResourcesValue); + /// The environment has a transient failure. + public static EnvironmentProvisioningState TransientFailure { get; } = new EnvironmentProvisioningState(TransientFailureValue); + /// The environment storage provisioning failed. + public static EnvironmentProvisioningState StorageProvisioningFailed { get; } = new EnvironmentProvisioningState(StorageProvisioningFailedValue); + /// Determines if two values are the same. + public static bool operator ==(EnvironmentProvisioningState left, EnvironmentProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnvironmentProvisioningState left, EnvironmentProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EnvironmentProvisioningState(string value) => new EnvironmentProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnvironmentProvisioningState other && Equals(other); + /// + public bool Equals(EnvironmentProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentTypeStatus.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentTypeStatus.cs new file mode 100644 index 000000000000..876624a4bb6d --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/EnvironmentTypeStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates whether an environment type is enabled for use in a project. + public readonly partial struct EnvironmentTypeStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EnvironmentTypeStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// The environment type is enabled for use in the project. + public static EnvironmentTypeStatus Enabled { get; } = new EnvironmentTypeStatus(EnabledValue); + /// The environment type is not enabled for use in the project. + public static EnvironmentTypeStatus Disabled { get; } = new EnvironmentTypeStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(EnvironmentTypeStatus left, EnvironmentTypeStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnvironmentTypeStatus left, EnvironmentTypeStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EnvironmentTypeStatus(string value) => new EnvironmentTypeStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnvironmentTypeStatus other && Equals(other); + /// + public bool Equals(EnvironmentTypeStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/HibernateSupport.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/HibernateSupport.cs new file mode 100644 index 000000000000..a89c3ec878f3 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/HibernateSupport.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates whether hibernate is supported and enabled, disabled, or unsupported by the operating system. Unknown hibernate support is represented as null. + public readonly partial struct HibernateSupport : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HibernateSupport(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + private const string OsUnsupportedValue = "OsUnsupported"; + + /// Hibernate is enabled. + public static HibernateSupport Enabled { get; } = new HibernateSupport(EnabledValue); + /// Hibernate is not enabled. + public static HibernateSupport Disabled { get; } = new HibernateSupport(DisabledValue); + /// Hibernate is not supported by the operating system. + public static HibernateSupport OsUnsupported { get; } = new HibernateSupport(OsUnsupportedValue); + /// Determines if two values are the same. + public static bool operator ==(HibernateSupport left, HibernateSupport right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HibernateSupport left, HibernateSupport right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HibernateSupport(string value) => new HibernateSupport(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HibernateSupport other && Equals(other); + /// + public bool Equals(HibernateSupport other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/LocalAdministratorStatus.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/LocalAdministratorStatus.cs new file mode 100644 index 000000000000..0c26561b50a9 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/LocalAdministratorStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates whether owners of Dev Boxes in a pool are local administrators on the Dev Boxes. + public readonly partial struct LocalAdministratorStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LocalAdministratorStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Owners of Dev Boxes in the pool are local administrators on the Dev Boxes. + public static LocalAdministratorStatus Enabled { get; } = new LocalAdministratorStatus(EnabledValue); + /// Owners of Dev Boxes in the pool are not local administrators on the Dev Boxes. + public static LocalAdministratorStatus Disabled { get; } = new LocalAdministratorStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(LocalAdministratorStatus left, LocalAdministratorStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LocalAdministratorStatus left, LocalAdministratorStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LocalAdministratorStatus(string value) => new LocalAdministratorStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LocalAdministratorStatus other && Equals(other); + /// + public bool Equals(LocalAdministratorStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.Serialization.cs new file mode 100644 index 000000000000..18a0156ed000 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class OSDisk : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OSDisk)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(DiskSizeGB)) + { + writer.WritePropertyName("diskSizeGB"u8); + writer.WriteNumberValue(DiskSizeGB.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + OSDisk IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OSDisk)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOSDisk(document.RootElement, options); + } + + internal static OSDisk DeserializeOSDisk(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? diskSizeGB = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("diskSizeGB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + diskSizeGB = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new OSDisk(diskSizeGB, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OSDisk)} does not support '{options.Format}' format."); + } + } + + OSDisk IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOSDisk(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OSDisk)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static OSDisk FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOSDisk(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.cs new file mode 100644 index 000000000000..2f15b624a167 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/OSDisk.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Settings for the operating system disk. + public partial class OSDisk + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OSDisk() + { + } + + /// Initializes a new instance of . + /// The size of the OS Disk in gigabytes. + /// Keeps track of any properties unknown to the library. + internal OSDisk(int? diskSizeGB, IDictionary serializedAdditionalRawData) + { + DiskSizeGB = diskSizeGB; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The size of the OS Disk in gigabytes. + public int? DiskSizeGB { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PoolHealthStatus.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PoolHealthStatus.cs new file mode 100644 index 000000000000..b00a2ada3793 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PoolHealthStatus.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Pool status indicating whether a pool is available to create Dev Boxes. + public readonly partial struct PoolHealthStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PoolHealthStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string PendingValue = "Pending"; + private const string HealthyValue = "Healthy"; + private const string WarningValue = "Warning"; + private const string UnhealthyValue = "Unhealthy"; + + /// The pool health status is not known. + public static PoolHealthStatus Unknown { get; } = new PoolHealthStatus(UnknownValue); + /// The pool health status waiting for health checks to run. + public static PoolHealthStatus Pending { get; } = new PoolHealthStatus(PendingValue); + /// The pool health status is healthy. + public static PoolHealthStatus Healthy { get; } = new PoolHealthStatus(HealthyValue); + /// The pool health status has one or more warnings. + public static PoolHealthStatus Warning { get; } = new PoolHealthStatus(WarningValue); + /// The pool health status is not healthy. + public static PoolHealthStatus Unhealthy { get; } = new PoolHealthStatus(UnhealthyValue); + /// Determines if two values are the same. + public static bool operator ==(PoolHealthStatus left, PoolHealthStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PoolHealthStatus left, PoolHealthStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PoolHealthStatus(string value) => new PoolHealthStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PoolHealthStatus other && Equals(other); + /// + public bool Equals(PoolHealthStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PowerState.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PowerState.cs new file mode 100644 index 000000000000..58d3010f93fd --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/PowerState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The power states of a Dev Box. + public readonly partial struct PowerState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PowerState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnknownValue = "Unknown"; + private const string RunningValue = "Running"; + private const string DeallocatedValue = "Deallocated"; + private const string PoweredOffValue = "PoweredOff"; + private const string HibernatedValue = "Hibernated"; + + /// The Dev Box power state is not known. + public static PowerState Unknown { get; } = new PowerState(UnknownValue); + /// The Dev Box is running. + public static PowerState Running { get; } = new PowerState(RunningValue); + /// The Dev Box is deallocated. + public static PowerState Deallocated { get; } = new PowerState(DeallocatedValue); + /// The Dev Box is powered off. + public static PowerState PoweredOff { get; } = new PowerState(PoweredOffValue); + /// The Dev Box is hibernated. + public static PowerState Hibernated { get; } = new PowerState(HibernatedValue); + /// Determines if two values are the same. + public static bool operator ==(PowerState left, PowerState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PowerState left, PowerState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PowerState(string value) => new PowerState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PowerState other && Equals(other); + /// + public bool Equals(PowerState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.Serialization.cs new file mode 100644 index 000000000000..ee0f4473ef89 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class RemoteConnection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemoteConnection)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(WebUri)) + { + writer.WritePropertyName("webUrl"u8); + writer.WriteStringValue(WebUri.AbsoluteUri); + } + if (Optional.IsDefined(RdpConnectionUri)) + { + writer.WritePropertyName("rdpConnectionUrl"u8); + writer.WriteStringValue(RdpConnectionUri.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RemoteConnection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemoteConnection)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRemoteConnection(document.RootElement, options); + } + + internal static RemoteConnection DeserializeRemoteConnection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri webUrl = default; + Uri rdpConnectionUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("webUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + webUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("rdpConnectionUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rdpConnectionUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new RemoteConnection(webUrl, rdpConnectionUrl, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RemoteConnection)} does not support '{options.Format}' format."); + } + } + + RemoteConnection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRemoteConnection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RemoteConnection)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RemoteConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRemoteConnection(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.cs new file mode 100644 index 000000000000..5e56227f2188 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/RemoteConnection.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Provides remote connection information for a Dev Box. + public partial class RemoteConnection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RemoteConnection() + { + } + + /// Initializes a new instance of . + /// URL to open a browser based RDP session. + /// Link to open a Remote Desktop session. + /// Keeps track of any properties unknown to the library. + internal RemoteConnection(Uri webUri, Uri rdpConnectionUri, IDictionary serializedAdditionalRawData) + { + WebUri = webUri; + RdpConnectionUri = rdpConnectionUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// URL to open a browser based RDP session. + public Uri WebUri { get; } + /// Link to open a Remote Desktop session. + public Uri RdpConnectionUri { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleFrequency.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleFrequency.cs new file mode 100644 index 000000000000..2ae149cd8d8d --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleFrequency.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The frequency of task execution. + public readonly partial struct ScheduleFrequency : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScheduleFrequency(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DailyValue = "Daily"; + + /// The scheduled task will run every day. + public static ScheduleFrequency Daily { get; } = new ScheduleFrequency(DailyValue); + /// Determines if two values are the same. + public static bool operator ==(ScheduleFrequency left, ScheduleFrequency right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScheduleFrequency left, ScheduleFrequency right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScheduleFrequency(string value) => new ScheduleFrequency(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScheduleFrequency other && Equals(other); + /// + public bool Equals(ScheduleFrequency other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleType.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleType.cs new file mode 100644 index 000000000000..f6d9c8ed63b6 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/ScheduleType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// The supported types for a scheduled task. + public readonly partial struct ScheduleType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScheduleType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StopDevBoxValue = "StopDevBox"; + + /// The scheduled task will stop impacted Dev Boxes. + public static ScheduleType StopDevBox { get; } = new ScheduleType(StopDevBoxValue); + /// Determines if two values are the same. + public static bool operator ==(ScheduleType left, ScheduleType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScheduleType left, ScheduleType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScheduleType(string value) => new ScheduleType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScheduleType other && Equals(other); + /// + public bool Equals(ScheduleType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/SkuName.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/SkuName.cs new file mode 100644 index 000000000000..abaff195d925 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/SkuName.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates the Dev Box compute. + public readonly partial struct SkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string GeneralI8c32gb256ssdV2Value = "general_i_8c32gb256ssd_v2"; + private const string GeneralI8c32gb512ssdV2Value = "general_i_8c32gb512ssd_v2"; + private const string GeneralI8c32gb1024ssdV2Value = "general_i_8c32gb1024ssd_v2"; + private const string GeneralI8c32gb2048ssdV2Value = "general_i_8c32gb2048ssd_v2"; + private const string GeneralI16c64gb256ssdV2Value = "general_i_16c64gb256ssd_v2"; + private const string GeneralI16c64gb512ssdV2Value = "general_i_16c64gb512ssd_v2"; + private const string GeneralI16c64gb1024ssdV2Value = "general_i_16c64gb1024ssd_v2"; + private const string GeneralI16c64gb2048ssdV2Value = "general_i_16c64gb2048ssd_v2"; + private const string GeneralI32c128gb512ssdV2Value = "general_i_32c128gb512ssd_v2"; + private const string GeneralI32c128gb1024ssdV2Value = "general_i_32c128gb1024ssd_v2"; + private const string GeneralI32c128gb2048ssdV2Value = "general_i_32c128gb2048ssd_v2"; + private const string GeneralA8c32gb256ssdV2Value = "general_a_8c32gb256ssd_v2"; + private const string GeneralA8c32gb512ssdV2Value = "general_a_8c32gb512ssd_v2"; + private const string GeneralA8c32gb1024ssdV2Value = "general_a_8c32gb1024ssd_v2"; + private const string GeneralA8c32gb2048ssdV2Value = "general_a_8c32gb2048ssd_v2"; + private const string GeneralA16c64gb256ssdV2Value = "general_a_16c64gb256ssd_v2"; + private const string GeneralA16c64gb512ssdV2Value = "general_a_16c64gb512ssd_v2"; + private const string GeneralA16c64gb1024ssdV2Value = "general_a_16c64gb1024ssd_v2"; + private const string GeneralA16c64gb2048ssdV2Value = "general_a_16c64gb2048ssd_v2"; + private const string GeneralA32c128gb512ssdV2Value = "general_a_32c128gb512ssd_v2"; + private const string GeneralA32c128gb1024ssdV2Value = "general_a_32c128gb1024ssd_v2"; + private const string GeneralA32c128gb2048ssdV2Value = "general_a_32c128gb2048ssd_v2"; + + /// Intel, 8 vCPU, 32 GB RAM, 256 GB Storage. + public static SkuName GeneralI8c32gb256ssdV2 { get; } = new SkuName(GeneralI8c32gb256ssdV2Value); + /// Intel, 8 vCPU, 32 GB RAM, 512 GB Storage. + public static SkuName GeneralI8c32gb512ssdV2 { get; } = new SkuName(GeneralI8c32gb512ssdV2Value); + /// Intel, 8 vCPU, 32 GB RAM, 1024 GB Storage. + public static SkuName GeneralI8c32gb1024ssdV2 { get; } = new SkuName(GeneralI8c32gb1024ssdV2Value); + /// Intel, 8 vCPU, 32 GB RAM, 2048 GB Storage. + public static SkuName GeneralI8c32gb2048ssdV2 { get; } = new SkuName(GeneralI8c32gb2048ssdV2Value); + /// Intel, 16 vCPU, 64 GB RAM, 256 GB Storage. + public static SkuName GeneralI16c64gb256ssdV2 { get; } = new SkuName(GeneralI16c64gb256ssdV2Value); + /// Intel, 16 vCPU, 64 GB RAM, 512 GB Storage. + public static SkuName GeneralI16c64gb512ssdV2 { get; } = new SkuName(GeneralI16c64gb512ssdV2Value); + /// Intel, 16 vCPU, 64 GB RAM, 1024 GB Storage. + public static SkuName GeneralI16c64gb1024ssdV2 { get; } = new SkuName(GeneralI16c64gb1024ssdV2Value); + /// Intel, 16 vCPU, 64 GB RAM, 2048 GB Storage. + public static SkuName GeneralI16c64gb2048ssdV2 { get; } = new SkuName(GeneralI16c64gb2048ssdV2Value); + /// Intel, 32 vCPU, 128 GB RAM, 512 GB Storage. + public static SkuName GeneralI32c128gb512ssdV2 { get; } = new SkuName(GeneralI32c128gb512ssdV2Value); + /// Intel, 32 vCPU, 128 GB RAM, 1024 GB Storage. + public static SkuName GeneralI32c128gb1024ssdV2 { get; } = new SkuName(GeneralI32c128gb1024ssdV2Value); + /// Intel, 32 vCPU, 128 GB RAM, 2048 GB Storage. + public static SkuName GeneralI32c128gb2048ssdV2 { get; } = new SkuName(GeneralI32c128gb2048ssdV2Value); + /// AMD, 8 vCPU, 32 GB RAM, 256 GB Storage. + public static SkuName GeneralA8c32gb256ssdV2 { get; } = new SkuName(GeneralA8c32gb256ssdV2Value); + /// AMD, 8 vCPU, 32 GB RAM, 512 GB Storage. + public static SkuName GeneralA8c32gb512ssdV2 { get; } = new SkuName(GeneralA8c32gb512ssdV2Value); + /// AMD, 8 vCPU, 32 GB RAM, 1024 GB Storage. + public static SkuName GeneralA8c32gb1024ssdV2 { get; } = new SkuName(GeneralA8c32gb1024ssdV2Value); + /// AMD, 8 vCPU, 32 GB RAM, 2048 GB Storage. + public static SkuName GeneralA8c32gb2048ssdV2 { get; } = new SkuName(GeneralA8c32gb2048ssdV2Value); + /// AMD, 16 vCPU, 64 GB RAM, 256 GB Storage. + public static SkuName GeneralA16c64gb256ssdV2 { get; } = new SkuName(GeneralA16c64gb256ssdV2Value); + /// AMD, 16 vCPU, 64 GB RAM, 512 GB Storage. + public static SkuName GeneralA16c64gb512ssdV2 { get; } = new SkuName(GeneralA16c64gb512ssdV2Value); + /// AMD, 16 vCPU, 64 GB RAM, 1024 GB Storage. + public static SkuName GeneralA16c64gb1024ssdV2 { get; } = new SkuName(GeneralA16c64gb1024ssdV2Value); + /// AMD, 16 vCPU, 64 GB RAM, 2048 GB Storage. + public static SkuName GeneralA16c64gb2048ssdV2 { get; } = new SkuName(GeneralA16c64gb2048ssdV2Value); + /// AMD, 32 vCPU, 128 GB RAM, 512 GB Storage. + public static SkuName GeneralA32c128gb512ssdV2 { get; } = new SkuName(GeneralA32c128gb512ssdV2Value); + /// AMD, 32 vCPU, 128 GB RAM, 1024 GB Storage. + public static SkuName GeneralA32c128gb1024ssdV2 { get; } = new SkuName(GeneralA32c128gb1024ssdV2Value); + /// AMD, 32 vCPU, 128 GB RAM, 2048 GB Storage. + public static SkuName GeneralA32c128gb2048ssdV2 { get; } = new SkuName(GeneralA32c128gb2048ssdV2Value); + /// Determines if two values are the same. + public static bool operator ==(SkuName left, SkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SkuName left, SkuName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SkuName(string value) => new SkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SkuName other && Equals(other); + /// + public bool Equals(SkuName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.Serialization.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.Serialization.cs new file mode 100644 index 000000000000..a16f4a4edbc6 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Developer.DevCenter.Models +{ + public partial class StopOnDisconnectConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, new ModelReaderWriterOptions("W")); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StopOnDisconnectConfiguration)} does not support '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(GracePeriodMinutes)) + { + writer.WritePropertyName("gracePeriodMinutes"u8); + writer.WriteNumberValue(GracePeriodMinutes.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StopOnDisconnectConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StopOnDisconnectConfiguration)} does not support '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStopOnDisconnectConfiguration(document.RootElement, options); + } + + internal static StopOnDisconnectConfiguration DeserializeStopOnDisconnectConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= new ModelReaderWriterOptions("W"); + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + StopOnDisconnectStatus status = default; + int? gracePeriodMinutes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + status = new StopOnDisconnectStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("gracePeriodMinutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + gracePeriodMinutes = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = additionalPropertiesDictionary; + return new StopOnDisconnectConfiguration(status, gracePeriodMinutes, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(StopOnDisconnectConfiguration)} does not support '{options.Format}' format."); + } + } + + StopOnDisconnectConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStopOnDisconnectConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StopOnDisconnectConfiguration)} does not support '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static StopOnDisconnectConfiguration FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStopOnDisconnectConfiguration(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.cs new file mode 100644 index 000000000000..c0d0c33d2477 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectConfiguration.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Developer.DevCenter.Models +{ + /// Stop on disconnect configuration settings for Dev Boxes created in this pool. + public partial class StopOnDisconnectConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Indicates whether the feature to stop the devbox on disconnect once the grace + /// period has lapsed is enabled. + /// + internal StopOnDisconnectConfiguration(StopOnDisconnectStatus status) + { + Status = status; + } + + /// Initializes a new instance of . + /// + /// Indicates whether the feature to stop the devbox on disconnect once the grace + /// period has lapsed is enabled. + /// + /// + /// The specified time in minutes to wait before stopping a Dev Box once disconnect + /// is detected. + /// + /// Keeps track of any properties unknown to the library. + internal StopOnDisconnectConfiguration(StopOnDisconnectStatus status, int? gracePeriodMinutes, IDictionary serializedAdditionalRawData) + { + Status = status; + GracePeriodMinutes = gracePeriodMinutes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StopOnDisconnectConfiguration() + { + } + + /// + /// Indicates whether the feature to stop the devbox on disconnect once the grace + /// period has lapsed is enabled. + /// + public StopOnDisconnectStatus Status { get; } + /// + /// The specified time in minutes to wait before stopping a Dev Box once disconnect + /// is detected. + /// + public int? GracePeriodMinutes { get; } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectStatus.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectStatus.cs new file mode 100644 index 000000000000..26e75979bbb4 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Models/StopOnDisconnectStatus.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Developer.DevCenter.Models +{ + /// Indicates whether the feature to stop the devbox on disconnect once the grace period has lapsed is enabled. + public readonly partial struct StopOnDisconnectStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StopOnDisconnectStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Stop on disconnect is enabled on the Dev Box. + public static StopOnDisconnectStatus Enabled { get; } = new StopOnDisconnectStatus(EnabledValue); + /// Stop on disconnect is not enabled on the Dev Box. + public static StopOnDisconnectStatus Disabled { get; } = new StopOnDisconnectStatus(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(StopOnDisconnectStatus left, StopOnDisconnectStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StopOnDisconnectStatus left, StopOnDisconnectStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StopOnDisconnectStatus(string value) => new StopOnDisconnectStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StopOnDisconnectStatus other && Equals(other); + /// + public bool Equals(StopOnDisconnectStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DeploymentEnvironmentsClient.cs.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DeploymentEnvironmentsClient.cs.cs new file mode 100644 index 000000000000..bc11e3d51a03 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DeploymentEnvironmentsClient.cs.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.DevCenter.Samples +{ + public partial class Samples_DeploymentEnvironmentsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", ""); + Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "", environment); + DevCenterEnvironment responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", ""); + Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "", environment); + DevCenterEnvironment responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", "") + { + Parameters = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, + }; + Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "", environment); + DevCenterEnvironment responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + DevCenterEnvironment environment = new DevCenterEnvironment("", "", "", "") + { + Parameters = + { + ["key"] = BinaryData.FromObjectAsJson(new object()) + }, + }; + Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "", environment); + DevCenterEnvironment responseData = operation.Value; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DevBoxesClient.cs new file mode 100644 index 000000000000..a3f8f332db61 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Custom/Samples_DevBoxesClient.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.DevCenter.Samples +{ + public partial class Samples_DevBoxesClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_CreateDevBox_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + DevBox devBox = new DevBox("", ""); + Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "", devBox); + DevBox responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_CreateDevBox_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + DevBox devBox = new DevBox("", ""); + Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "", devBox); + DevBox responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_CreateDevBox_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + DevBox devBox = new DevBox("", "") + { + LocalAdministratorStatus = LocalAdministratorStatus.Enabled, + }; + Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "", devBox); + DevBox responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_CreateDevBox_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + DevBox devBox = new DevBox("", "") + { + LocalAdministratorStatus = LocalAdministratorStatus.Enabled, + }; + Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "", devBox); + DevBox responseData = operation.Value; + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DeploymentEnvironmentsClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DeploymentEnvironmentsClientTests.cs new file mode 100644 index 000000000000..48a8fc9a4305 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DeploymentEnvironmentsClientTests.cs @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.DevCenter.Tests +{ + public class DeploymentEnvironmentsClientTests : RecordedTestBase + { + private const string EnvName = "DevTestEnv"; + private const string EnvDefinitionName = "Sandbox"; + private DeploymentEnvironmentsClient _environmentsClient; + + internal DeploymentEnvironmentsClient GetEnvironmentsClient() => + InstrumentClient(new DeploymentEnvironmentsClient( + TestEnvironment.Endpoint, + TestEnvironment.Credential, + InstrumentClientOptions(new DevCenterClientOptions()))); + + public DeploymentEnvironmentsClientTests(bool isAsync) : base(isAsync) + { + } + + [SetUp] + public void SetUp() + { + _environmentsClient = GetEnvironmentsClient(); + } + + [Test] + public async Task GetCatalogsSucceeds() + { + List catalogs = await _environmentsClient.GetCatalogsAsync( + TestEnvironment.ProjectName).ToEnumerableAsync(); + + Assert.AreEqual(1, catalogs.Count); + + string catalogName = catalogs[0].Name; + if (string.IsNullOrWhiteSpace(catalogName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(TestEnvironment.CatalogName, catalogName); + } + + [Test] + public async Task GetCatalogSucceeds() + { + DevCenterCatalog catalog = await _environmentsClient.GetCatalogAsync( + TestEnvironment.ProjectName, + TestEnvironment.CatalogName); + + string catalogName = catalog.Name; + if (string.IsNullOrWhiteSpace(catalogName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(TestEnvironment.CatalogName, catalogName); + } + + [Test] + public async Task GetEnvironmentTypesSucceeds() + { + List envTypes = await _environmentsClient.GetEnvironmentTypesAsync( + TestEnvironment.ProjectName).ToEnumerableAsync(); + + Assert.AreEqual(1, envTypes.Count); + + string envTypeName = envTypes[0].Name; + if (string.IsNullOrWhiteSpace(envTypeName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(TestEnvironment.EnvironmentTypeName, envTypeName); + } + + [Test] + public async Task GetEnvironmentDefinitionSucceeds() + { + EnvironmentDefinition envDefinition = await _environmentsClient.GetEnvironmentDefinitionAsync( + TestEnvironment.ProjectName, + TestEnvironment.CatalogName, + EnvDefinitionName); + + string envDefinitionName = envDefinition.Name; + if (string.IsNullOrWhiteSpace(envDefinitionName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(EnvDefinitionName, envDefinitionName); + } + + [Test] + public async Task GetEnvironmentDefinitionsSucceeds() + { + List envDefinitions = await _environmentsClient.GetEnvironmentDefinitionsAsync( + TestEnvironment.ProjectName).ToEnumerableAsync(); + + Assert.AreEqual(3, envDefinitions.Count); + + foreach (var envDefinition in envDefinitions) + { + string envDefinitionName = envDefinition.Name; + if (string.IsNullOrWhiteSpace(envDefinitionName)) + { + FailDueToMissingProperty("name"); + } + + TestContext.WriteLine(envDefinitionName); + } + } + + [Test] + public async Task GetEnvironmentDefinitionsByCatalogSucceeds() + { + List envDefinitions = await _environmentsClient.GetEnvironmentDefinitionsByCatalogAsync( + TestEnvironment.ProjectName, + TestEnvironment.CatalogName).ToEnumerableAsync(); + + Assert.AreEqual(3, envDefinitions.Count); + + foreach (var envDefinition in envDefinitions) + { + string envDefinitionsName = envDefinition.Name; + if (string.IsNullOrWhiteSpace(envDefinitionsName)) + { + FailDueToMissingProperty("name"); + } + + TestContext.WriteLine(envDefinitionsName); + } + } + + [Test] + public async Task CreateAndDeleteEnvironmentSucceeds() + { + await SetUpEnvironmentAsync(); + await DeleteEnvironmentAsync(); + } + + [Test] + public async Task GetEnvironmentSucceeds() + { + DevCenterEnvironment environment = await GetEnvironmentAsync(); + + if (environment == default) + { + await SetUpEnvironmentAsync(); + environment = await GetEnvironmentAsync(); + } + + string envName = environment.Name; + if (string.IsNullOrWhiteSpace(envName)) + { + FailDueToMissingProperty("name"); + } + + Assert.IsTrue(EnvName.Equals(envName, StringComparison.OrdinalIgnoreCase)); + } + + [Test] + public async Task GetEnvironmentsSucceeds() + { + var environments = await GetEnvironmentsAsync(); + + if (!environments.Any()) + { + await SetUpEnvironmentAsync(); + environments = await GetEnvironmentsAsync(); + } + + Assert.AreEqual(1, environments.Count); + + string envName = environments[0].Name; + if (string.IsNullOrWhiteSpace(envName)) + { + FailDueToMissingProperty("name"); + } + + Assert.IsTrue(EnvName.Equals(envName, StringComparison.OrdinalIgnoreCase)); + } + + [Test] + public async Task GetAllEnvironmentsSucceeds() + { + var environments = await GetAllEnvironmentsAsync(); + + if (!environments.Any()) + { + await SetUpEnvironmentAsync(); + environments = await GetAllEnvironmentsAsync(); + } + + Assert.AreEqual(1, environments.Count); + + string envName = environments[0].Name; + if (string.IsNullOrWhiteSpace(envName)) + { + FailDueToMissingProperty("name"); + } + + Assert.IsTrue(EnvName.Equals(envName, StringComparison.OrdinalIgnoreCase)); + } + + private async Task GetEnvironmentAsync() + { + try + { + return (await _environmentsClient.GetEnvironmentAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + EnvName)).Value; + } + // if environment doesn't exist Get Environment will throw an error + catch + { + return default; + } + } + + private async Task> GetEnvironmentsAsync() + { + return await _environmentsClient.GetEnvironmentsAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId).ToEnumerableAsync(); + } + + private async Task> GetAllEnvironmentsAsync() + { + return await _environmentsClient.GetAllEnvironmentsAsync( + TestEnvironment.ProjectName).ToEnumerableAsync(); + } + + private async Task SetUpEnvironmentAsync() + { + var environment = new DevCenterEnvironment + ( + EnvName, + TestEnvironment.EnvironmentTypeName, + TestEnvironment.CatalogName, + EnvDefinitionName + ); + + Operation environmentCreateOperation = await _environmentsClient.CreateOrUpdateEnvironmentAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + environment); + + EnvironmentProvisioningState? provisioningState = environmentCreateOperation.Value.ProvisioningState; + Assert.IsTrue(provisioningState.Equals(EnvironmentProvisioningState.Succeeded)); + } + + private async Task DeleteEnvironmentAsync() + { + Operation environmentDeleteOperation = await _environmentsClient.DeleteEnvironmentAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + EnvName); + + CheckLROSucceeded(environmentDeleteOperation); + } + + private void CheckLROSucceeded(Operation finalOperationResponse) + { + var responseData = finalOperationResponse.GetRawResponse().Content; + var response = JsonDocument.Parse(responseData).RootElement; + + if (!response.TryGetProperty("status", out var responseStatusJson)) + { + FailDueToMissingProperty("status"); + } + + var status = responseStatusJson.ToString(); + Assert.True(status.Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); + } + + private void FailDueToMissingProperty(string propertyName) + { + Assert.Fail($"The JSON response received from the service does not include the necessary property: {propertyName}"); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs deleted file mode 100644 index cdf35967a31f..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs +++ /dev/null @@ -1,453 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Net; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.TestFramework; -using NUnit.Framework; - -namespace Azure.Developer.DevCenter.Tests -{ - [PlaybackOnly("As deploy/delete manipulations with real resources take time.")] - public class DevBoxClientTests : RecordedTestBase - { - public const string DevBoxName = "MyDevBox"; - - private DevBoxesClient _devBoxesClient; - - internal DevBoxesClient GetDevBoxesClient() => - InstrumentClient(new DevBoxesClient( - TestEnvironment.Endpoint, - TestEnvironment.Credential, - InstrumentClientOptions(new AzureDeveloperDevCenterClientOptions()))); - - public DevBoxClientTests(bool isAsync) : base(isAsync) - { - } - - [SetUp] - public async Task SetUpAsync() - { - _devBoxesClient = GetDevBoxesClient(); - await SetUpDevBoxAsync(); - } - - [TearDown] - public async Task TearDownAsync() - { - Operation devBoxDeleteOperation = await _devBoxesClient.DeleteDevBoxAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName); - - await devBoxDeleteOperation.WaitForCompletionResponseAsync(); - Console.WriteLine($"Completed dev box deletion."); - } - - [RecordedTest] - public async Task StartAndStopDevBoxSucceeds() - { - // At this point we should have a running dev box, let's stop it - Operation devBoxStopOperation = await _devBoxesClient.StopDevBoxAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - TestEnvironment.hibernate, - TestEnvironment.context); - - BinaryData devBoxData = devBoxStopOperation.GetRawResponse().Content; - JsonElement devBox = JsonDocument.Parse(devBoxData).RootElement; - - if (!devBox.TryGetProperty("status", out var devBoxStatusJson)) - { - FailDueToMissingProperty("status"); - } - - string devBoxStatus = devBoxStatusJson.ToString(); - Assert.True(devBoxStatus.Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); - - // Start the dev box - Operation devBoxStartOperation = await _devBoxesClient.StartDevBoxAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - TestEnvironment.context); - - devBoxData = devBoxStartOperation.GetRawResponse().Content; - devBox = JsonDocument.Parse(devBoxData).RootElement; - - if (!devBox.TryGetProperty("status", out devBoxStatusJson)) - { - FailDueToMissingProperty("status"); - } - - devBoxStatus = devBoxStatusJson.ToString(); - Assert.True(devBoxStatus.Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); - } - - [RecordedTest] - public async Task GetRemoteConnectionSucceeds() - { - Response remoteConnectionResponse = await _devBoxesClient.GetRemoteConnectionAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - TestEnvironment.context); - - JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; - - // Check webUrl - if (!remoteConnectionData.TryGetProperty("webUrl", out var webUrlJson)) - { - FailDueToMissingProperty("webUrl"); - } - - string uriString = webUrlJson.ToString(); - - bool validConnectionUri = Uri.TryCreate(uriString, UriKind.Absolute, out Uri uriResult) - && uriResult.Scheme == Uri.UriSchemeHttps; - - Assert.True(validConnectionUri); - - // Check RDP connection string - if (!remoteConnectionData.TryGetProperty("rdpConnectionUrl", out var rdpConnectionUrlJson)) - { - FailDueToMissingProperty("rdpConnectionUrl"); - } - - string rdpConnectionUrlString = rdpConnectionUrlJson.ToString(); - Assert.False(string.IsNullOrEmpty(rdpConnectionUrlString)); - Assert.True(rdpConnectionUrlString.StartsWith("ms-avd")); - } - - [RecordedTest] - public async Task GetDevBoxSucceeds() - { - Response devBoxResponse = await _devBoxesClient.GetDevBoxAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - TestEnvironment.context); - - JsonElement devBoxResponseData = JsonDocument.Parse(devBoxResponse.ContentStream).RootElement; - - if (!devBoxResponseData.TryGetProperty("name", out var devBoxNameJson)) - { - FailDueToMissingProperty("name"); - } - - string devBoxName = devBoxNameJson.ToString(); - Assert.AreEqual(devBoxName, DevBoxName); - } - - [RecordedTest] - public async Task GetDevBoxesSucceeds() - { - int numberOfReturnedDevBoxes = 0; - - await foreach (BinaryData devBoxData in _devBoxesClient.GetDevBoxesAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedDevBoxes++; - JsonElement devBoxResponseData = JsonDocument.Parse(devBoxData.ToStream()).RootElement; - - if (!devBoxResponseData.TryGetProperty("name", out var devBoxNameJson)) - { - FailDueToMissingProperty("name"); - } - - string devBoxName = devBoxNameJson.ToString(); - Assert.AreEqual(devBoxName, DevBoxName); - } - - Assert.AreEqual(1, numberOfReturnedDevBoxes); - } - - [RecordedTest] - public async Task GetAllDevBoxesSucceeds() - { - int numberOfReturnedDevBoxes = 0; - - await foreach (BinaryData devBoxData in _devBoxesClient.GetAllDevBoxesAsync( - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedDevBoxes++; - JsonElement devBoxResponseData = JsonDocument.Parse(devBoxData.ToStream()).RootElement; - - if (!devBoxResponseData.TryGetProperty("name", out var devBoxNameJson)) - { - FailDueToMissingProperty("name"); - } - - string devBoxName = devBoxNameJson.ToString(); - Assert.AreEqual(devBoxName, DevBoxName); - } - - Assert.AreEqual(1, numberOfReturnedDevBoxes); - } - - [RecordedTest] - public async Task GetAllDevBoxesByUserSucceeds() - { - int numberOfReturnedDevBoxes = 0; - - await foreach (BinaryData devBoxData in _devBoxesClient.GetAllDevBoxesByUserAsync( - TestEnvironment.MeUserId, - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedDevBoxes++; - JsonElement devBoxResponseData = JsonDocument.Parse(devBoxData.ToStream()).RootElement; - - if (!devBoxResponseData.TryGetProperty("name", out var devBoxNameJson)) - { - FailDueToMissingProperty("name"); - } - - string devBoxName = devBoxNameJson.ToString(); - Assert.AreEqual(devBoxName, DevBoxName); - } - - Assert.AreEqual(1, numberOfReturnedDevBoxes); - } - - [RecordedTest] - public async Task GetPoolSucceeds() - { - Response getPoolResponse = await _devBoxesClient.GetPoolAsync( - TestEnvironment.ProjectName, - TestEnvironment.PoolName, - TestEnvironment.context); - - JsonElement getPoolData = JsonDocument.Parse(getPoolResponse.ContentStream).RootElement; - - if (!getPoolData.TryGetProperty("name", out var poolNameJson)) - { - FailDueToMissingProperty("name"); - } - - string poolName = poolNameJson.ToString(); - Assert.AreEqual(poolName, TestEnvironment.PoolName); - } - - [RecordedTest] - public async Task GetPoolsSucceeds() - { - var numberOfReturnedPools = 0; - await foreach (BinaryData poolData in _devBoxesClient.GetPoolsAsync( - TestEnvironment.ProjectName, - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedPools++; - JsonElement getPoolsResponseData = JsonDocument.Parse(poolData.ToStream()).RootElement; - - if (!getPoolsResponseData.TryGetProperty("name", out var poolNameJson)) - { - FailDueToMissingProperty("name"); - } - - string poolName = poolNameJson.ToString(); - Assert.AreEqual(poolName, TestEnvironment.PoolName); - } - - Assert.AreEqual(1, numberOfReturnedPools); - } - - [RecordedTest] - public async Task GetSchedulesSucceeds() - { - var numberOfReturnedSchedules = 0; - await foreach (BinaryData scheduleData in _devBoxesClient.GetSchedulesAsync( - TestEnvironment.ProjectName, - TestEnvironment.PoolName, - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedSchedules++; - JsonElement getSchedulesResponseData = JsonDocument.Parse(scheduleData.ToStream()).RootElement; - - if (!getSchedulesResponseData.TryGetProperty("name", out var scheduleNameJson)) - { - FailDueToMissingProperty("name"); - } - - string scheduleName = scheduleNameJson.ToString(); - Assert.AreEqual("default", scheduleName); - } - - Assert.AreEqual(1, numberOfReturnedSchedules); - } - - [RecordedTest] - public async Task GetScheduleSucceeds() - { - Response getScheduleResponse = await _devBoxesClient.GetScheduleAsync( - TestEnvironment.ProjectName, - TestEnvironment.PoolName, - "default", - TestEnvironment.context); - - JsonElement getScheduleData = JsonDocument.Parse(getScheduleResponse.ContentStream).RootElement; - - if (!getScheduleData.TryGetProperty("name", out var scheduleNameJson)) - { - FailDueToMissingProperty("name"); - } - - string scheduleName = scheduleNameJson.ToString(); - Assert.AreEqual("default", scheduleName); - } - - [RecordedTest] - public async Task GetActionsSucceeds() - { - var numberOfReturnedActions = 0; - await foreach (BinaryData actionsData in _devBoxesClient.GetDevBoxActionsAsync(TestEnvironment.ProjectName, TestEnvironment.MeUserId, DevBoxName, TestEnvironment.context)) - { - numberOfReturnedActions++; - JsonElement getActionsResponseData = JsonDocument.Parse(actionsData.ToStream()).RootElement; - - if (!getActionsResponseData.TryGetProperty("name", out var actionNameJson)) - { - FailDueToMissingProperty("name"); - } - - string actionName = actionNameJson.ToString(); - Assert.AreEqual("schedule-default", actionName); - } - - Assert.AreEqual(1, numberOfReturnedActions); - } - - [RecordedTest] - public async Task GetActionSucceeds() - { - Response getActionResponse = await _devBoxesClient.GetDevBoxActionAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - "schedule-default", - TestEnvironment.context); - - JsonElement getActionData = JsonDocument.Parse(getActionResponse.ContentStream).RootElement; - - if (!getActionData.TryGetProperty("name", out var actionNameJson)) - { - FailDueToMissingProperty("name"); - } - - string actionName = actionNameJson.ToString(); - Assert.AreEqual("schedule-default", actionName); - } - - [RecordedTest] - public async Task SkipActionSucceeds() - { - Response skipActionResponse = await _devBoxesClient.SkipActionAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - "schedule-default"); - - Assert.AreEqual((int)HttpStatusCode.NoContent, skipActionResponse.Status); - } - - [RecordedTest] - public async Task DelayActionSucceeds() - { - // Using fixed time to match sessions records - string time = "2023-05-02T16:01:53.3821556Z"; - DateTimeOffset delayUntil = DateTimeOffset.Parse(time); - - Response delayActionResponse = await _devBoxesClient.DelayActionAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - "schedule-default", - delayUntil, - TestEnvironment.context); - - JsonElement delayActionData = JsonDocument.Parse(delayActionResponse.ContentStream).RootElement; - if (!delayActionData.TryGetProperty("next", out var nextActionTimeJson)) - { - FailDueToMissingProperty("next"); - } - - if (!nextActionTimeJson.TryGetProperty("scheduledTime", out var scheduledTimeJson)) - { - FailDueToMissingProperty("scheduledTime"); - } - - Assert.AreEqual(time, scheduledTimeJson.ToString()); - } - - [RecordedTest] - public async Task DelayAllActionsSucceeds() - { - // Using fixed time to match sessions records - DateTimeOffset delayUntil = DateTimeOffset.Parse("2023-05-02T16:01:53.3821556Z"); - var numberOfReturnedActions = 0; - - await foreach (BinaryData actionsData in _devBoxesClient.DelayAllActionsAsync(TestEnvironment.ProjectName, TestEnvironment.MeUserId, DevBoxName, delayUntil, TestEnvironment.context)) - { - numberOfReturnedActions++; - JsonElement getActionsResponseData = JsonDocument.Parse(actionsData.ToStream()).RootElement; - - if (!getActionsResponseData.TryGetProperty("result", out var actionResultJson)) - { - FailDueToMissingProperty("result"); - } - - string actionResultName = actionResultJson.ToString(); - Assert.AreEqual("Succeeded", actionResultName); - } - - Assert.AreEqual(1, numberOfReturnedActions); - } - - private async Task SetUpDevBoxAsync() - { - var content = new - { - poolName = TestEnvironment.PoolName, - }; - - // Create dev box - Operation devBoxCreateOperation = await _devBoxesClient.CreateDevBoxAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - DevBoxName, - RequestContent.Create(content)); - - BinaryData devBoxData = await devBoxCreateOperation.WaitForCompletionAsync(); - JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).RootElement; - string devBoxProvisioningState = devBox.GetProperty("provisioningState").ToString(); - - // Both states indicate successful provisioning - bool devBoxProvisionSucceeded = devBoxProvisioningState.Equals("Succeeded", StringComparison.OrdinalIgnoreCase) || devBoxProvisioningState.Equals("ProvisionedWithWarning", StringComparison.OrdinalIgnoreCase); - Assert.IsTrue(devBoxProvisionSucceeded); - } - - private void FailDueToMissingProperty(string propertyName) - { - Assert.Fail($"The JSON response received from the service does not include the necessary property: {propertyName}"); - } - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxesClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxesClientTests.cs new file mode 100644 index 000000000000..f2d69ff87894 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxesClientTests.cs @@ -0,0 +1,406 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.DevCenter.Tests +{ + public class DevBoxesClientTests : RecordedTestBase + { + public const string DevBoxName = "MyDevBox"; + + private DevBoxesClient _devBoxesClient; + + internal DevBoxesClient GetDevBoxesClient() => + InstrumentClient(new DevBoxesClient( + TestEnvironment.Endpoint, + TestEnvironment.Credential, + InstrumentClientOptions(new DevCenterClientOptions()))); + + public DevBoxesClientTests(bool isAsync) : base(isAsync) + { + } + + [SetUp] + public async Task SetUpAsync() + { + _devBoxesClient = GetDevBoxesClient(); + await SetUpDevBoxAsync(); + } + + [Test] + public async Task StartAndStopDevBoxSucceeds() + { + // At this point we should have a running dev box, let's stop it + Operation devBoxStopOperation = await _devBoxesClient.StopDevBoxAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + CheckLROSucceeded(devBoxStopOperation); + + // Start the dev box + Operation devBoxStartOperation = await _devBoxesClient.StartDevBoxAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + CheckLROSucceeded(devBoxStartOperation); + } + + [Test] + public async Task RestartDevBoxSucceeds() + { + Operation devBoxRestartOperation = await _devBoxesClient.RestartDevBoxAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + CheckLROSucceeded(devBoxRestartOperation); + } + + [Test] + public async Task GetRemoteConnectionSucceeds() + { + RemoteConnection remoteConnection = await _devBoxesClient.GetRemoteConnectionAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + // Check webUrl + Uri webUrl = remoteConnection.WebUri; + if (webUrl == null) + { + FailDueToMissingProperty("webUrl"); + } + + Assert.AreEqual(webUrl.Scheme, Uri.UriSchemeHttps); + + // Check RDP connection + Uri remoteConnectionUrl = remoteConnection.RdpConnectionUri; + if (remoteConnectionUrl == null) + { + FailDueToMissingProperty("rdpConnectionUrl"); + } + + Assert.AreEqual(remoteConnectionUrl.Scheme, "ms-avd"); + } + + [Test] + public async Task GetDevBoxSucceeds() + { + DevBox devBox = await _devBoxesClient.GetDevBoxAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + string devBoxName = devBox.Name; + if (string.IsNullOrWhiteSpace(devBoxName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(devBoxName, DevBoxName); + } + + [Test] + public async Task GetDevBoxesSucceeds() + { + List devBoxes = await _devBoxesClient.GetDevBoxesAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId).ToEnumerableAsync(); + + Assert.AreEqual(1, devBoxes.Count); + + string devBoxName = devBoxes[0].Name; + if (string.IsNullOrWhiteSpace(devBoxName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(devBoxName, DevBoxName); + } + + [Test] + public async Task GetAllDevBoxesSucceeds() + { + List devBoxes = await _devBoxesClient.GetAllDevBoxesAsync().ToEnumerableAsync(); + + Assert.AreEqual(1, devBoxes.Count); + + string devBoxName = devBoxes[0].Name; + if (string.IsNullOrWhiteSpace(devBoxName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(devBoxName, DevBoxName); + } + + [Test] + public async Task GetAllDevBoxesByUserSucceeds() + { + List devBoxes = await _devBoxesClient.GetAllDevBoxesByUserAsync(TestEnvironment.MeUserId).ToEnumerableAsync(); + + Assert.AreEqual(1, devBoxes.Count); + + string devBoxName = devBoxes[0].Name; + if (string.IsNullOrWhiteSpace(devBoxName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(devBoxName, DevBoxName); + } + + [Test] + public async Task GetPoolSucceeds() + { + DevBoxPool pool = await _devBoxesClient.GetPoolAsync( + TestEnvironment.ProjectName, + TestEnvironment.PoolName); + + string poolName = pool.Name; + if (string.IsNullOrWhiteSpace(poolName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(poolName, TestEnvironment.PoolName); + } + + [Test] + public async Task GetPoolsSucceeds() + { + List pools = await _devBoxesClient.GetPoolsAsync(TestEnvironment.ProjectName).ToEnumerableAsync(); + + Assert.AreEqual(1, pools.Count); + + string poolName = pools[0].Name; + if (string.IsNullOrWhiteSpace(poolName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(poolName, TestEnvironment.PoolName); + } + + [Test] + public async Task GetScheduleSucceeds() + { + DevBoxSchedule schedule = await _devBoxesClient.GetScheduleAsync( + TestEnvironment.ProjectName, + TestEnvironment.PoolName, + "default"); + + string scheduleName = schedule.Name; + if (string.IsNullOrWhiteSpace(scheduleName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual("default", scheduleName); + } + + [Test] + public async Task GetSchedulesSucceeds() + { + List schedules = await _devBoxesClient.GetSchedulesAsync( + TestEnvironment.ProjectName, + TestEnvironment.PoolName).ToEnumerableAsync(); + + Assert.AreEqual(1, schedules.Count); + + string scheduleName = schedules[0].Name; + if (string.IsNullOrWhiteSpace(scheduleName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual("default", scheduleName); + } + + [Test] + public async Task GetAndDelayActionSucceeds() + { + DevBoxAction action = await _devBoxesClient.GetDevBoxActionAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName, + "schedule-default"); + + if (action == null) + { + FailDueToMissingProperty("action"); + } + + Assert.AreEqual("schedule-default", action.Name); + Assert.AreEqual(DevBoxActionType.Stop, action.ActionType); + + DateTimeOffset currentScheduledTime = action.NextAction.ScheduledTime; + if (currentScheduledTime == default) + { + FailDueToMissingProperty("scheduledTime"); + } + + DateTimeOffset delayUntil = currentScheduledTime.AddMinutes(10); + + DevBoxAction delayedAction = await _devBoxesClient.DelayActionAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName, + action.Name, + delayUntil); + + DateTimeOffset delayedTime = delayedAction.NextAction.ScheduledTime; + if (delayedTime == default) + { + FailDueToMissingProperty("scheduledTime"); + } + + Assert.AreEqual(delayUntil, delayedTime); + } + + [Test] + public async Task GetAndDelayAllActionsSucceeds() + { + List devBoxActions = await _devBoxesClient.GetDevBoxActionsAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName).ToEnumerableAsync(); + + Assert.AreEqual(1, devBoxActions.Count); + + var action = devBoxActions[0]; + if (string.IsNullOrWhiteSpace(action.Name)) + { + FailDueToMissingProperty("name"); + } + Assert.AreEqual("schedule-default", action.Name); + + DateTimeOffset delayUntil = action.NextAction.ScheduledTime.AddMinutes(10); + + List actionsDelayResult = await _devBoxesClient.DelayAllActionsAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName, + delayUntil).ToEnumerableAsync(); + + Assert.AreEqual(1, actionsDelayResult.Count); + + DevBoxActionDelayStatus actionDelayStatus = actionsDelayResult[0].DelayStatus; + if (actionDelayStatus == default) + { + FailDueToMissingProperty("actionDelayStatus"); + } + + Assert.AreEqual(DevBoxActionDelayStatus.Succeeded, actionDelayStatus); + } + + [Test] + public async Task SkipActionAndDeleteDevBoxSucceeds() + { + //This test will run for each target framework. Since Skip Action can run only once - if you skip action in a machine that + //already has the scheduled shutdown skipped it will fail. So we need no delete the machine, and SetUp will create a new one for each test + + Response skipActionResponse = await _devBoxesClient.SkipActionAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName, + "schedule-default"); + + Assert.AreEqual((int)HttpStatusCode.NoContent, skipActionResponse.Status); + + Operation devBoxDeleteOperation = await _devBoxesClient.DeleteDevBoxAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName); + + CheckLROSucceeded(devBoxDeleteOperation); + } + + private async Task SetUpDevBoxAsync() + { + DevBox devBox = await GetDevBoxAsync(); + if (devBox == default) + { + devBox = await CreateDevBoxAsync(); + } + + string devBoxName = devBox.Name; + if (string.IsNullOrWhiteSpace(devBoxName)) + { + FailDueToMissingProperty("name"); + } + + Assert.AreEqual(devBoxName, DevBoxName); + + DevBoxProvisioningState? devBoxProvisioningState = devBox.ProvisioningState; + + // Both states indicate successful provisioning + bool devBoxProvisionSucceeded = + devBoxProvisioningState.Equals(DevBoxProvisioningState.Succeeded) || + devBoxProvisioningState.Equals(DevBoxProvisioningState.ProvisionedWithWarning); + + Assert.IsTrue(devBoxProvisionSucceeded); + } + + private async Task GetDevBoxAsync() + { + List devBoxes = await _devBoxesClient.GetDevBoxesAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId).ToEnumerableAsync(); + + return devBoxes.Where(d => d.Name.Equals(DevBoxName)).FirstOrDefault(); + } + + private async Task CreateDevBoxAsync() + { + DevBox devBox = new DevBox + ( + DevBoxName, + TestEnvironment.PoolName + ); + + Operation devBoxCreateOperation = await _devBoxesClient.CreateDevBoxAsync( + WaitUntil.Completed, + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + devBox); + + return devBoxCreateOperation.Value; + } + + private void CheckLROSucceeded(Operation finalOperationResponse) + { + var responseData = finalOperationResponse.GetRawResponse().Content; + var response = JsonDocument.Parse(responseData).RootElement; + + if (!response.TryGetProperty("status", out var responseStatusJson)) + { + FailDueToMissingProperty("status"); + } + + var status = responseStatusJson.ToString(); + Assert.True(status.Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); + } + + private void FailDueToMissingProperty(string propertyName) + { + Assert.Fail($"The response received from the service does not include the necessary property: {propertyName}"); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs deleted file mode 100644 index e977cd5f0281..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Azure.Core.TestFramework; - -namespace Azure.Developer.DevCenter.Tests -{ - public class DevCenterClientTestEnvironment : TestEnvironment - { - public Uri Endpoint => new(GetRecordedVariable("DEFAULT_DEVCENTER_ENDPOINT")); - public string ProjectName => GetRecordedVariable("DEFAULT_PROJECT_NAME"); - public string PoolName => GetRecordedVariable("DEFAULT_POOL_NAME"); - public string CatalogName => GetRecordedVariable("DEFAULT_CATALOG_NAME"); - public string EnvironmentTypeName => GetRecordedVariable("DEFAULT_ENVIRONMENT_TYPE_NAME"); - public string UserId => GetRecordedVariable("STATIC_TEST_USER_ID"); - public string MeUserId => "me"; - public RequestContext context = null; - public string filter = null; - public int? maxCount = null; - public bool? hibernate = null; - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs index b20dc210fbc3..f083789cec02 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs @@ -2,14 +2,16 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; using NUnit.Framework; namespace Azure.Developer.DevCenter.Tests { - [PlaybackOnly("As deploy/delete manipulations with real resources take time.")] public class DevCenterClientTests : RecordedTestBase { private DevCenterClient _devCenterClient; @@ -18,7 +20,7 @@ internal DevCenterClient GetDevCenterClient() => InstrumentClient(new DevCenterClient( TestEnvironment.Endpoint, TestEnvironment.Credential, - InstrumentClientOptions(new AzureDeveloperDevCenterClientOptions()))); + InstrumentClientOptions(new DevCenterClientOptions()))); public DevCenterClientTests(bool isAsync) : base(isAsync) { @@ -30,43 +32,33 @@ public void SetUp() _devCenterClient = GetDevCenterClient(); } - [RecordedTest] + [Test] public async Task GetProjectsSucceeds() { - var numberOfReturnedProjects = 0; - await foreach (BinaryData projectData in _devCenterClient.GetProjectsAsync( - TestEnvironment.filter, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedProjects++; - JsonElement projectResponseData = JsonDocument.Parse(projectData.ToStream()).RootElement; + List projects = await _devCenterClient.GetProjectsAsync().ToEnumerableAsync(); - if (!projectResponseData.TryGetProperty("name", out var projectNameJson)) - { - Assert.Fail($"The JSON response received from the service does not include the necessary property: {"name"}"); - } + Assert.AreEqual(1, projects.Count); - string projectName = projectNameJson.ToString(); - Assert.AreEqual(TestEnvironment.ProjectName, projectName); + string projectName = projects[0].Name; + if (string.IsNullOrWhiteSpace(projectName)) + { + Assert.Fail($"The response received from the service does not include the necessary property: {"name"}"); } - Assert.AreEqual(1, numberOfReturnedProjects); + Assert.AreEqual(TestEnvironment.ProjectName, projectName); } - [RecordedTest] + [Test] public async Task GetProjectSucceeds() { - Response getProjectResponse = await _devCenterClient.GetProjectAsync(TestEnvironment.ProjectName, TestEnvironment.context); - - JsonElement getProjectData = JsonDocument.Parse(getProjectResponse.ContentStream).RootElement; + DevCenterProject project = await _devCenterClient.GetProjectAsync(TestEnvironment.ProjectName); - if (!getProjectData.TryGetProperty("name", out var projectNameJson)) + string projectName = project.Name; + if (string.IsNullOrWhiteSpace(projectName)) { - Assert.Fail($"The JSON response received from the service does not include the necessary property: {"name"}"); + Assert.Fail($"The response received from the service does not include the necessary property: {"name"}"); } - string projectName = projectNameJson.ToString(); Assert.AreEqual(TestEnvironment.ProjectName, projectName); } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs deleted file mode 100644 index 79e8207521ca..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.TestFramework; -using NUnit.Framework; - -namespace Azure.Developer.DevCenter.Tests -{ - [PlaybackOnly("As deploy/delete manipulations with real resources take time.")] - public class EnvironmentsClientTests : RecordedTestBase - { - private const string EnvName = "DevTestEnv"; - private DeploymentEnvironmentsClient _environmentsClient; - - internal DeploymentEnvironmentsClient GetEnvironmentsClient() => - InstrumentClient(new DeploymentEnvironmentsClient( - TestEnvironment.Endpoint, - TestEnvironment.Credential, - InstrumentClientOptions(new AzureDeveloperDevCenterClientOptions()))); - - public EnvironmentsClientTests(bool isAsync) : base(isAsync) - { - } - - [SetUp] - public void SetUp() - { - _environmentsClient = GetEnvironmentsClient(); - } - - [RecordedTest] - public async Task GetCatalogsSucceeds() - { - var numberOfReturnedCatalogs = 0; - await foreach (BinaryData catalogData in _environmentsClient.GetCatalogsAsync( - TestEnvironment.ProjectName, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfReturnedCatalogs++; - JsonElement catalogResponseData = JsonDocument.Parse(catalogData.ToStream()).RootElement; - - if (!catalogResponseData.TryGetProperty("name", out var catalogNameJson)) - { - FailDueToMissingProperty("name"); - } - - string catalogName = catalogNameJson.ToString(); - Assert.AreEqual(TestEnvironment.CatalogName, catalogName); - } - - Assert.AreEqual(1, numberOfReturnedCatalogs); - } - - [RecordedTest] - public async Task GetCatalogSucceeds() - { - Response getCatalogResponse = await _environmentsClient.GetCatalogAsync(TestEnvironment.ProjectName, TestEnvironment.CatalogName, TestEnvironment.context); - JsonElement getCatalogData = JsonDocument.Parse(getCatalogResponse.ContentStream).RootElement; - - if (!getCatalogData.TryGetProperty("name", out var catalogNameJson)) - { - FailDueToMissingProperty("name"); - } - - string catalogName = catalogNameJson.ToString(); - Assert.AreEqual(TestEnvironment.CatalogName, catalogName); - } - - [RecordedTest] - public async Task GetEnvironmentTypesSucceeds() - { - var numberOfEnvTypes = 0; - await foreach (BinaryData envTypeData in _environmentsClient.GetEnvironmentTypesAsync( - TestEnvironment.ProjectName, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfEnvTypes++; - JsonElement envTypeResponseData = JsonDocument.Parse(envTypeData.ToStream()).RootElement; - - if (!envTypeResponseData.TryGetProperty("name", out var envTypeNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envTypeName = envTypeNameJson.ToString(); - Assert.AreEqual(TestEnvironment.EnvironmentTypeName, envTypeName); - } - - Assert.AreEqual(1, numberOfEnvTypes); - } - - [RecordedTest] - public async Task GetEnvironmentDefinitionsSucceeds() - { - var numberOfEnvDefinitions = 0; - await foreach (BinaryData envDefinitionsData in _environmentsClient.GetEnvironmentDefinitionsAsync(TestEnvironment.ProjectName, TestEnvironment.maxCount, TestEnvironment.context)) - { - numberOfEnvDefinitions++; - JsonElement envDefinitionsResponseData = JsonDocument.Parse(envDefinitionsData.ToStream()).RootElement; - - if (!envDefinitionsResponseData.TryGetProperty("name", out var envDefinitionsNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envDefinitionsName = envDefinitionsNameJson.ToString(); - Console.WriteLine(envDefinitionsName); - } - - Assert.AreEqual(3, numberOfEnvDefinitions); - } - - [RecordedTest] - public async Task GetEnvironmentDefinitionsByCatalogSucceeds() - { - var numberOfEnvDefinitions = 0; - await foreach (BinaryData envDefinitionsData in _environmentsClient.GetEnvironmentDefinitionsByCatalogAsync( - TestEnvironment.ProjectName, - TestEnvironment.CatalogName, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfEnvDefinitions++; - JsonElement envDefinitionsResponseData = JsonDocument.Parse(envDefinitionsData.ToStream()).RootElement; - - if (!envDefinitionsResponseData.TryGetProperty("name", out var envDefinitionsNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envDefinitionsName = envDefinitionsNameJson.ToString(); - Console.WriteLine(envDefinitionsName); - } - - Assert.AreEqual(3, numberOfEnvDefinitions); - } - - [RecordedTest] - public async Task GetEnvironmentSucceeds() - { - await SetUpEnvironmentAsync(); - - Response getEnvResponse = await _environmentsClient.GetEnvironmentAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - EnvName, - TestEnvironment.context); - JsonElement getEnvData = JsonDocument.Parse(getEnvResponse.ContentStream).RootElement; - - if (!getEnvData.TryGetProperty("name", out var envNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envName = envNameJson.ToString(); - Assert.IsTrue(EnvName.Equals(envName, StringComparison.OrdinalIgnoreCase)); - - await DeleteEnvironmentAsync(); - } - - [RecordedTest] - public async Task GetEnvironmentsSucceeds() - { - var numberOfEnvironments = await GetEnvironmentsAsync(); - - if (numberOfEnvironments == 0) - { - await SetUpEnvironmentAsync(); - } - - numberOfEnvironments = await GetEnvironmentsAsync(); - Assert.AreEqual(1, numberOfEnvironments); - - await DeleteEnvironmentAsync(); - } - - [RecordedTest] - public async Task GetAllEnvironmentsSucceeds() - { - var numberOfEnvironments = await GetAllEnvironmentsAsync(); - - if (numberOfEnvironments == 0) - { - await SetUpEnvironmentAsync(); - } - - numberOfEnvironments = await GetAllEnvironmentsAsync(); - Assert.AreEqual(1, numberOfEnvironments); - - await DeleteEnvironmentAsync(); - } - - private async Task GetAllEnvironmentsAsync() - { - var numberOfEnvironments = 0; - await foreach (BinaryData environmentsData in _environmentsClient.GetAllEnvironmentsAsync( - TestEnvironment.ProjectName, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfEnvironments++; - JsonElement environmentsResponseData = JsonDocument.Parse(environmentsData.ToStream()).RootElement; - - if (!environmentsResponseData.TryGetProperty("name", out var environmentNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envName = environmentNameJson.ToString(); - Console.WriteLine(envName); - } - - return numberOfEnvironments; - } - - private async Task GetEnvironmentsAsync() - { - var numberOfEnvironments = 0; - await foreach (BinaryData environmentsData in _environmentsClient.GetEnvironmentsAsync( - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - numberOfEnvironments++; - JsonElement environmentsResponseData = JsonDocument.Parse(environmentsData.ToStream()).RootElement; - - if (!environmentsResponseData.TryGetProperty("name", out var environmentNameJson)) - { - FailDueToMissingProperty("name"); - } - - string envName = environmentNameJson.ToString(); - Console.WriteLine(envName); - } - - return numberOfEnvironments; - } - - private async Task SetUpEnvironmentAsync() - { - string envDefinitionsName = string.Empty; - - await foreach (BinaryData envDefinitionsData in _environmentsClient.GetEnvironmentDefinitionsByCatalogAsync( - TestEnvironment.ProjectName, - TestEnvironment.CatalogName, - TestEnvironment.maxCount, - TestEnvironment.context)) - { - JsonElement envDefinitionsResponseData = JsonDocument.Parse(envDefinitionsData.ToStream()).RootElement; - - if (!envDefinitionsResponseData.TryGetProperty("name", out var envDefinitionsNameJson)) - { - FailDueToMissingProperty("name"); - } - - envDefinitionsName = envDefinitionsNameJson.ToString(); - if (envDefinitionsName == "Sandbox") break; - } - - var content = new - { - environmentDefinitionName = envDefinitionsName, - catalogName = TestEnvironment.CatalogName, - environmentType = TestEnvironment.EnvironmentTypeName, - }; - - Operation environmentCreateOperation = await _environmentsClient.CreateOrUpdateEnvironmentAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - EnvName, - RequestContent.Create(content)); - - BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync(); - JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement; - - var provisioningState = environment.GetProperty("provisioningState").ToString(); - Assert.IsTrue(provisioningState.Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); - } - - private async Task DeleteEnvironmentAsync() - { - Operation environmentDeleteOperation = await _environmentsClient.DeleteEnvironmentAsync( - WaitUntil.Completed, - TestEnvironment.ProjectName, - TestEnvironment.MeUserId, - EnvName); - - await environmentDeleteOperation.WaitForCompletionResponseAsync(); - Console.WriteLine($"Completed environment deletion."); - } - - private void FailDueToMissingProperty(string propertyName) - { - Assert.Fail($"The JSON response received from the service does not include the necessary property: {propertyName}"); - } - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs index d309ea256ab5..6a10ecb302d2 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs @@ -9,6 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; using Azure.Core; +using Azure.Developer.DevCenter.Models; using Azure.Identity; using NUnit.Framework; @@ -18,7 +19,7 @@ public partial class Samples_DeploymentEnvironmentsClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironment_ShortVersion() + public void Example_Environment_GetEnvironment_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -27,6 +28,7 @@ public void Example_EnvironmentClientOperations_GetEnvironment_ShortVersion() Response response = client.GetEnvironment("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -34,7 +36,7 @@ public void Example_EnvironmentClientOperations_GetEnvironment_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironment_ShortVersion_Async() + public async Task Example_Environment_GetEnvironment_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -43,6 +45,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironment_ShortVersio Response response = await client.GetEnvironmentAsync("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -50,7 +53,29 @@ public async Task Example_EnvironmentClientOperations_GetEnvironment_ShortVersio [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironment_AllParameters() + public void Example_Environment_GetEnvironment_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironment("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Environment_GetEnvironment_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Environment_GetEnvironment_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -59,7 +84,7 @@ public void Example_EnvironmentClientOperations_GetEnvironment_AllParameters() Response response = client.GetEnvironment("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -75,7 +100,7 @@ public void Example_EnvironmentClientOperations_GetEnvironment_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironment_AllParameters_Async() + public async Task Example_Environment_GetEnvironment_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -84,7 +109,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironment_AllParamete Response response = await client.GetEnvironmentAsync("", "", "", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -100,7 +125,29 @@ public async Task Example_EnvironmentClientOperations_GetEnvironment_AllParamete [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetCatalog_ShortVersion() + public void Example_Environment_GetEnvironment_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironment("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Environment_GetEnvironment_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Catalog_GetCatalog_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -114,7 +161,7 @@ public void Example_EnvironmentClientOperations_GetCatalog_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetCatalog_ShortVersion_Async() + public async Task Example_Catalog_GetCatalog_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -128,7 +175,29 @@ public async Task Example_EnvironmentClientOperations_GetCatalog_ShortVersion_As [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetCatalog_AllParameters() + public void Example_Catalog_GetCatalog_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetCatalog("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Catalog_GetCatalog_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetCatalogAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Catalog_GetCatalog_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -142,7 +211,7 @@ public void Example_EnvironmentClientOperations_GetCatalog_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetCatalog_AllParameters_Async() + public async Task Example_Catalog_GetCatalog_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -156,7 +225,29 @@ public async Task Example_EnvironmentClientOperations_GetCatalog_AllParameters_A [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironmentDefinition_ShortVersion() + public void Example_Catalog_GetCatalog_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetCatalog("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Catalog_GetCatalog_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetCatalogAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentDefinition_GetEnvironmentDefinition_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -172,7 +263,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinition_ShortVe [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinition_ShortVersion_Async() + public async Task Example_EnvironmentDefinition_GetEnvironmentDefinition_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -188,7 +279,29 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinition_S [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetEnvironmentDefinition_AllParameters() + public void Example_EnvironmentDefinition_GetEnvironmentDefinition_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironmentDefinition("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentDefinition_GetEnvironmentDefinition_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentDefinition_GetEnvironmentDefinition_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -215,7 +328,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinition_AllPara [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinition_AllParameters_Async() + public async Task Example_EnvironmentDefinition_GetEnvironmentDefinition_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -240,6 +353,28 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinition_A Console.WriteLine(result.GetProperty("templatePath").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentDefinition_GetEnvironmentDefinition_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironmentDefinition("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentDefinition_GetEnvironmentDefinition_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetAllEnvironments_ShortVersion() @@ -248,9 +383,10 @@ public void Example_EnvironmentClientOperations_GetAllEnvironments_ShortVersion( TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetAllEnvironments("", null, null)) + foreach (BinaryData item in client.GetAllEnvironments("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -265,15 +401,42 @@ public async Task Example_EnvironmentClientOperations_GetAllEnvironments_ShortVe TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null, null)) + await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetAllEnvironments_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironment item in client.GetAllEnvironments("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetAllEnvironments_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetAllEnvironments_AllParameters() @@ -282,10 +445,10 @@ public void Example_EnvironmentClientOperations_GetAllEnvironments_AllParameters TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetAllEnvironments("", 1234, null)) + foreach (BinaryData item in client.GetAllEnvironments("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -308,10 +471,10 @@ public async Task Example_EnvironmentClientOperations_GetAllEnvironments_AllPara TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", 1234, null)) + await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -326,6 +489,32 @@ public async Task Example_EnvironmentClientOperations_GetAllEnvironments_AllPara } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetAllEnvironments_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironment item in client.GetAllEnvironments("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetAllEnvironments_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironment item in client.GetAllEnvironmentsAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironments_ShortVersion() @@ -334,9 +523,10 @@ public void Example_EnvironmentClientOperations_GetEnvironments_ShortVersion() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironments("", "", null, null)) + foreach (BinaryData item in client.GetEnvironments("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -351,15 +541,42 @@ public async Task Example_EnvironmentClientOperations_GetEnvironments_ShortVersi TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null, null)) + await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironments_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironment item in client.GetEnvironments("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironments_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironment item in client.GetEnvironmentsAsync("", "")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironments_AllParameters() @@ -368,10 +585,10 @@ public void Example_EnvironmentClientOperations_GetEnvironments_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironments("", "", 1234, null)) + foreach (BinaryData item in client.GetEnvironments("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -394,10 +611,10 @@ public async Task Example_EnvironmentClientOperations_GetEnvironments_AllParamet TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", 1234, null)) + await foreach (BinaryData item in client.GetEnvironmentsAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -414,13 +631,39 @@ public async Task Example_EnvironmentClientOperations_GetEnvironments_AllParamet [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetCatalogs_ShortVersion() + public void Example_EnvironmentClientOperations_GetEnvironments_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironment item in client.GetEnvironments("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironments_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironment item in client.GetEnvironmentsAsync("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Catalog_GetCatalogs_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetCatalogs("", null, null)) + foreach (BinaryData item in client.GetCatalogs("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -429,13 +672,13 @@ public void Example_EnvironmentClientOperations_GetCatalogs_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetCatalogs_ShortVersion_Async() + public async Task Example_Catalog_GetCatalogs_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetCatalogsAsync("", null, null)) + await foreach (BinaryData item in client.GetCatalogsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -444,13 +687,39 @@ public async Task Example_EnvironmentClientOperations_GetCatalogs_ShortVersion_A [Test] [Ignore("Only validating compilation of examples")] - public void Example_EnvironmentClientOperations_GetCatalogs_AllParameters() + public void Example_Catalog_GetCatalogs_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterCatalog item in client.GetCatalogs("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Catalog_GetCatalogs_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterCatalog item in client.GetCatalogsAsync("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Catalog_GetCatalogs_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetCatalogs("", 1234, null)) + foreach (BinaryData item in client.GetCatalogs("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -459,19 +728,45 @@ public void Example_EnvironmentClientOperations_GetCatalogs_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EnvironmentClientOperations_GetCatalogs_AllParameters_Async() + public async Task Example_Catalog_GetCatalogs_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetCatalogsAsync("", 1234, null)) + await foreach (BinaryData item in client.GetCatalogsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Catalog_GetCatalogs_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterCatalog item in client.GetCatalogs("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Catalog_GetCatalogs_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterCatalog item in client.GetCatalogsAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ShortVersion() @@ -480,7 +775,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ShortV TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentDefinitions("", null, null)) + foreach (BinaryData item in client.GetEnvironmentDefinitions("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -497,7 +792,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null, null)) + await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -506,6 +801,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitions("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_AllParameters() @@ -514,7 +835,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_AllPar TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentDefinitions("", 1234, null)) + foreach (BinaryData item in client.GetEnvironmentDefinitions("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -542,7 +863,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", 1234, null)) + await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -562,6 +883,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_ } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentDefinitions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitions("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_ShortVersion() @@ -570,7 +917,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatal TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null, null)) + foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -587,7 +934,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsB TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null, null)) + await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -596,6 +943,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsB } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalog("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalogAsync("", "")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_AllParameters() @@ -604,7 +977,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatal TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", 1234, null)) + foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -632,7 +1005,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsB TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", 1234, null)) + await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -652,6 +1025,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsB } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalog("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentDefinitionsByCatalog_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (EnvironmentDefinition item in client.GetEnvironmentDefinitionsByCatalogAsync("", "")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortVersion() @@ -660,7 +1059,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortVersion TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentTypes("", null, null)) + foreach (BinaryData item in client.GetEnvironmentTypes("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -677,7 +1076,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortV TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null, null)) + await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -686,6 +1085,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortV } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypes("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypesAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_GetEnvironmentTypes_AllParameters() @@ -694,7 +1119,7 @@ public void Example_EnvironmentClientOperations_GetEnvironmentTypes_AllParameter TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - foreach (BinaryData item in client.GetEnvironmentTypes("", 1234, null)) + foreach (BinaryData item in client.GetEnvironmentTypes("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -711,7 +1136,7 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_AllPar TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", 1234, null)) + await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -720,6 +1145,32 @@ public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_AllPar } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EnvironmentClientOperations_GetEnvironmentTypes_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypes("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EnvironmentClientOperations_GetEnvironmentTypes_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (DevCenterEnvironmentType item in client.GetEnvironmentTypesAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ShortVersion() @@ -738,6 +1189,7 @@ public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ShortV BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -761,6 +1213,7 @@ public async Task Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("catalogName").ToString()); Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); @@ -776,7 +1229,10 @@ public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_AllPar using RequestContent content = RequestContent.Create(new { - parameters = new object(), + parameters = new + { + key = new object(), + }, environmentType = "", catalogName = "", environmentDefinitionName = "", @@ -785,7 +1241,7 @@ public void Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_AllPar BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -809,7 +1265,10 @@ public async Task Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ using RequestContent content = RequestContent.Create(new { - parameters = new object(), + parameters = new + { + key = new object(), + }, environmentType = "", catalogName = "", environmentDefinitionName = "", @@ -818,7 +1277,7 @@ public async Task Example_EnvironmentClientOperations_CreateOrUpdateEnvironment_ BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("parameters").ToString()); + Console.WriteLine(result.GetProperty("parameters").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("environmentType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs index 9997d042eb85..e2014c863ea1 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs @@ -9,6 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; using Azure.Core; +using Azure.Developer.DevCenter.Models; using Azure.Identity; using NUnit.Framework; @@ -18,7 +19,7 @@ public partial class Samples_DevBoxesClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetPool_ShortVersion() + public void Example_Pool_GetPool_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -34,7 +35,7 @@ public void Example_DevBoxesClientOperations_GetPool_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetPool_ShortVersion_Async() + public async Task Example_Pool_GetPool_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -50,7 +51,29 @@ public async Task Example_DevBoxesClientOperations_GetPool_ShortVersion_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetPool_AllParameters() + public void Example_Pool_GetPool_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetPool("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Pool_GetPool_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetPoolAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Pool_GetPool_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -80,7 +103,7 @@ public void Example_DevBoxesClientOperations_GetPool_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetPool_AllParameters_Async() + public async Task Example_Pool_GetPool_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -110,7 +133,29 @@ public async Task Example_DevBoxesClientOperations_GetPool_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetSchedule_ShortVersion() + public void Example_Pool_GetPool_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetPool("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Pool_GetPool_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetPoolAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Schedule_GetSchedule_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -128,7 +173,7 @@ public void Example_DevBoxesClientOperations_GetSchedule_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetSchedule_ShortVersion_Async() + public async Task Example_Schedule_GetSchedule_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -146,7 +191,29 @@ public async Task Example_DevBoxesClientOperations_GetSchedule_ShortVersion_Asyn [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetSchedule_AllParameters() + public void Example_Schedule_GetSchedule_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetSchedule("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Schedule_GetSchedule_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetScheduleAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Schedule_GetSchedule_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -164,7 +231,7 @@ public void Example_DevBoxesClientOperations_GetSchedule_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetSchedule_AllParameters_Async() + public async Task Example_Schedule_GetSchedule_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -182,7 +249,29 @@ public async Task Example_DevBoxesClientOperations_GetSchedule_AllParameters_Asy [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBox_ShortVersion() + public void Example_Schedule_GetSchedule_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetSchedule("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Schedule_GetSchedule_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetScheduleAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBox_GetDevBox_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -197,7 +286,7 @@ public void Example_DevBoxesClientOperations_GetDevBox_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBox_ShortVersion_Async() + public async Task Example_DevBox_GetDevBox_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -212,7 +301,29 @@ public async Task Example_DevBoxesClientOperations_GetDevBox_ShortVersion_Async( [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBox_AllParameters() + public void Example_DevBox_GetDevBox_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetDevBox("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBox_GetDevBox_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetDevBoxAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBox_GetDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -251,7 +362,7 @@ public void Example_DevBoxesClientOperations_GetDevBox_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBox_AllParameters_Async() + public async Task Example_DevBox_GetDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -288,6 +399,28 @@ public async Task Example_DevBoxesClientOperations_GetDevBox_AllParameters_Async Console.WriteLine(result.GetProperty("localAdministrator").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBox_GetDevBox_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetDevBox("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBox_GetDevBox_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetDevBoxAsync("", "", ""); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetRemoteConnection_ShortVersion() @@ -316,6 +449,28 @@ public async Task Example_DevBoxesClientOperations_GetRemoteConnection_ShortVers Console.WriteLine(result.ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetRemoteConnection_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetRemoteConnection("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetRemoteConnection_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetRemoteConnectionAsync("", "", ""); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetRemoteConnection_AllParameters() @@ -348,7 +503,29 @@ public async Task Example_DevBoxesClientOperations_GetRemoteConnection_AllParame [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBoxAction_ShortVersion() + public void Example_DevBoxesClientOperations_GetRemoteConnection_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetRemoteConnection("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetRemoteConnection_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetRemoteConnectionAsync("", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxAction_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -364,7 +541,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxAction_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBoxAction_ShortVersion_Async() + public async Task Example_DevBoxAction_GetDevBoxAction_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -380,7 +557,29 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxAction_ShortVersion_ [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBoxAction_AllParameters() + public void Example_DevBoxAction_GetDevBoxAction_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetDevBoxAction("", "", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxAction_GetDevBoxAction_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetDevBoxActionAsync("", "", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxAction_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -398,7 +597,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxAction_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBoxAction_AllParameters_Async() + public async Task Example_DevBoxAction_GetDevBoxAction_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -414,6 +613,28 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxAction_AllParameters Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxAction_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.GetDevBoxAction("", "", "", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxAction_GetDevBoxAction_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.GetDevBoxActionAsync("", "", "", ""); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_SkipAction_ShortVersion() @@ -498,6 +719,28 @@ public async Task Example_DevBoxesClientOperations_DelayAction_ShortVersion_Asyn Console.WriteLine(result.GetProperty("sourceId").ToString()); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_DelayAction_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.DelayAction("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_DelayAction_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.DelayActionAsync("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_DelayAction_AllParameters() @@ -536,13 +779,35 @@ public async Task Example_DevBoxesClientOperations_DelayAction_AllParameters_Asy [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetPools_ShortVersion() + public void Example_DevBoxesClientOperations_DelayAction_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = client.DelayAction("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_DelayAction_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Response response = await client.DelayActionAsync("", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Pool_GetPools_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetPools("", null, null, null)) + foreach (BinaryData item in client.GetPools("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -553,13 +818,13 @@ public void Example_DevBoxesClientOperations_GetPools_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetPools_ShortVersion_Async() + public async Task Example_Pool_GetPools_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetPoolsAsync("", null, null, null)) + await foreach (BinaryData item in client.GetPoolsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -570,13 +835,39 @@ public async Task Example_DevBoxesClientOperations_GetPools_ShortVersion_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetPools_AllParameters() + public void Example_Pool_GetPools_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxPool item in client.GetPools("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Pool_GetPools_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxPool item in client.GetPoolsAsync("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Pool_GetPools_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetPools("", "", 1234, null)) + foreach (BinaryData item in client.GetPools("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -601,13 +892,13 @@ public void Example_DevBoxesClientOperations_GetPools_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetPools_AllParameters_Async() + public async Task Example_Pool_GetPools_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetPoolsAsync("", "", 1234, null)) + await foreach (BinaryData item in client.GetPoolsAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -632,51 +923,39 @@ public async Task Example_DevBoxesClientOperations_GetPools_AllParameters_Async( [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetSchedules_ShortVersion() + public void Example_Pool_GetPools_AllParameters_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetSchedules("", "", null, null, null)) + foreach (DevBoxPool item in client.GetPools("")) { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("frequency").ToString()); - Console.WriteLine(result.GetProperty("time").ToString()); - Console.WriteLine(result.GetProperty("timeZone").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetSchedules_ShortVersion_Async() + public async Task Example_Pool_GetPools_AllParameters_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetSchedulesAsync("", "", null, null, null)) + await foreach (DevBoxPool item in client.GetPoolsAsync("")) { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("frequency").ToString()); - Console.WriteLine(result.GetProperty("time").ToString()); - Console.WriteLine(result.GetProperty("timeZone").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetSchedules_AllParameters() + public void Example_Schedule_GetSchedules_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetSchedules("", "", "", 1234, null)) + foreach (BinaryData item in client.GetSchedules("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -689,13 +968,13 @@ public void Example_DevBoxesClientOperations_GetSchedules_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetSchedules_AllParameters_Async() + public async Task Example_Schedule_GetSchedules_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetSchedulesAsync("", "", "", 1234, null)) + await foreach (BinaryData item in client.GetSchedulesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -708,36 +987,152 @@ public async Task Example_DevBoxesClientOperations_GetSchedules_AllParameters_As [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion() + public void Example_Schedule_GetSchedules_ShortVersion_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetAllDevBoxes(null, null, null)) + foreach (DevBoxSchedule item in client.GetSchedules("", "")) { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("poolName").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion_Async() + public async Task Example_Schedule_GetSchedules_ShortVersion_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllDevBoxesAsync(null, null, null)) + await foreach (DevBoxSchedule item in client.GetSchedulesAsync("", "")) { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Schedule_GetSchedules_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetSchedules("", "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("time").ToString()); + Console.WriteLine(result.GetProperty("timeZone").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Schedule_GetSchedules_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.GetSchedulesAsync("", "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("time").ToString()); + Console.WriteLine(result.GetProperty("timeZone").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Schedule_GetSchedules_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxSchedule item in client.GetSchedules("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Schedule_GetSchedules_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxSchedule item in client.GetSchedulesAsync("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllDevBoxes(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("poolName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllDevBoxesAsync(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("poolName").ToString()); } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetAllDevBoxes()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetAllDevBoxesAsync()) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters() @@ -746,7 +1141,7 @@ public void Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetAllDevBoxes("", 1234, null)) + foreach (BinaryData item in client.GetAllDevBoxes(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -786,7 +1181,7 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters_ TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllDevBoxesAsync("", 1234, null)) + await foreach (BinaryData item in client.GetAllDevBoxesAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -818,6 +1213,32 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters_ } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetAllDevBoxes()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetAllDevBoxes_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetAllDevBoxesAsync()) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVersion() @@ -826,7 +1247,7 @@ public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVersion() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetAllDevBoxesByUser("", null, null, null)) + foreach (BinaryData item in client.GetAllDevBoxesByUser("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -842,7 +1263,7 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVer TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null, null, null)) + await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -850,6 +1271,32 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVer } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetAllDevBoxesByUser("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetAllDevBoxesByUserAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParameters() @@ -858,7 +1305,7 @@ public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParameters( TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetAllDevBoxesByUser("", "", 1234, null)) + foreach (BinaryData item in client.GetAllDevBoxesByUser("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -898,7 +1345,7 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParam TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", "", 1234, null)) + await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -930,6 +1377,32 @@ public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParam } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetAllDevBoxesByUser("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetAllDevBoxesByUser_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetAllDevBoxesByUserAsync("")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion() @@ -938,7 +1411,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetDevBoxes("", "", null, null, null)) + foreach (BinaryData item in client.GetDevBoxes("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -954,7 +1427,7 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion_Asyn TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null, null, null)) + await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -962,6 +1435,32 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion_Asyn } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetDevBoxes("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetDevBoxes_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetDevBoxesAsync("", "")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_GetDevBoxes_AllParameters() @@ -970,7 +1469,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxes_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetDevBoxes("", "", "", 1234, null)) + foreach (BinaryData item in client.GetDevBoxes("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -1010,7 +1509,7 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxes_AllParameters_Asy TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetDevBoxesAsync("", "", "", 1234, null)) + await foreach (BinaryData item in client.GetDevBoxesAsync("", "", null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -1044,7 +1543,33 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxes_AllParameters_Asy [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBoxActions_ShortVersion() + public void Example_DevBoxesClientOperations_GetDevBoxes_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBox item in client.GetDevBoxes("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_GetDevBoxes_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBox item in client.GetDevBoxesAsync("", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxActions_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -1061,7 +1586,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxActions_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBoxActions_ShortVersion_Async() + public async Task Example_DevBoxAction_GetDevBoxActions_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -1078,7 +1603,33 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxActions_ShortVersion [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevBoxesClientOperations_GetDevBoxActions_AllParameters() + public void Example_DevBoxAction_GetDevBoxActions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxAction item in client.GetDevBoxActions("", "", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxAction_GetDevBoxActions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxAction item in client.GetDevBoxActionsAsync("", "", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxActions_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -1097,7 +1648,7 @@ public void Example_DevBoxesClientOperations_GetDevBoxActions_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevBoxesClientOperations_GetDevBoxActions_AllParameters_Async() + public async Task Example_DevBoxAction_GetDevBoxActions_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -1114,6 +1665,32 @@ public async Task Example_DevBoxesClientOperations_GetDevBoxActions_AllParameter } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxAction_GetDevBoxActions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxAction item in client.GetDevBoxActions("", "", "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxAction_GetDevBoxActions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxAction item in client.GetDevBoxActionsAsync("", "", "")) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_DelayAllActions_ShortVersion() @@ -1146,6 +1723,32 @@ public async Task Example_DevBoxesClientOperations_DelayAllActions_ShortVersion_ } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_DelayAllActions_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxActionDelayResult item in client.DelayAllActions("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_DelayAllActions_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxActionDelayResult item in client.DelayAllActionsAsync("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_DelayAllActions_AllParameters() @@ -1196,6 +1799,32 @@ public async Task Example_DevBoxesClientOperations_DelayAllActions_AllParameters } } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DevBoxesClientOperations_DelayAllActions_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (DevBoxActionDelayResult item in client.DelayAllActions("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DevBoxesClientOperations_DelayAllActions_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (DevBoxActionDelayResult item in client.DelayAllActionsAsync("", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_DevBoxesClientOperations_CreateDevBox_ShortVersion() diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevCenterClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevCenterClient.cs index 34890ff1d3de..aeff4fca9a00 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevCenterClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevCenterClient.cs @@ -9,6 +9,7 @@ using System.Text.Json; using System.Threading.Tasks; using Azure.Core; +using Azure.Developer.DevCenter.Models; using Azure.Identity; using NUnit.Framework; @@ -18,7 +19,7 @@ public partial class Samples_DevCenterClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevCenterClientOperations_GetProject_ShortVersion() + public void Example_Project_GetProject_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -32,7 +33,7 @@ public void Example_DevCenterClientOperations_GetProject_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevCenterClientOperations_GetProject_ShortVersion_Async() + public async Task Example_Project_GetProject_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -46,7 +47,29 @@ public async Task Example_DevCenterClientOperations_GetProject_ShortVersion_Asyn [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevCenterClientOperations_GetProject_AllParameters() + public void Example_Project_GetProject_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + Response response = client.GetProject(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Project_GetProject_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + Response response = await client.GetProjectAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Project_GetProject_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -62,7 +85,7 @@ public void Example_DevCenterClientOperations_GetProject_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevCenterClientOperations_GetProject_AllParameters_Async() + public async Task Example_Project_GetProject_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -78,13 +101,35 @@ public async Task Example_DevCenterClientOperations_GetProject_AllParameters_Asy [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevCenterClientOperations_GetProjects_ShortVersion() + public void Example_Project_GetProject_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + Response response = client.GetProject(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Project_GetProject_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + Response response = await client.GetProjectAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Project_GetProjects_ShortVersion() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - foreach (BinaryData item in client.GetProjects(null, null, null)) + foreach (BinaryData item in client.GetProjects(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -93,13 +138,13 @@ public void Example_DevCenterClientOperations_GetProjects_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevCenterClientOperations_GetProjects_ShortVersion_Async() + public async Task Example_Project_GetProjects_ShortVersion_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - await foreach (BinaryData item in client.GetProjectsAsync(null, null, null)) + await foreach (BinaryData item in client.GetProjectsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -108,13 +153,39 @@ public async Task Example_DevCenterClientOperations_GetProjects_ShortVersion_Asy [Test] [Ignore("Only validating compilation of examples")] - public void Example_DevCenterClientOperations_GetProjects_AllParameters() + public void Example_Project_GetProjects_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + foreach (DevCenterProject item in client.GetProjects()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Project_GetProjects_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + await foreach (DevCenterProject item in client.GetProjectsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Project_GetProjects_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - foreach (BinaryData item in client.GetProjects("", 1234, null)) + foreach (BinaryData item in client.GetProjects(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -125,13 +196,13 @@ public void Example_DevCenterClientOperations_GetProjects_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DevCenterClientOperations_GetProjects_AllParameters_Async() + public async Task Example_Project_GetProjects_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - await foreach (BinaryData item in client.GetProjectsAsync("", 1234, null)) + await foreach (BinaryData item in client.GetProjectsAsync(null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -139,5 +210,31 @@ public async Task Example_DevCenterClientOperations_GetProjects_AllParameters_As Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); } } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Project_GetProjects_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + foreach (DevCenterProject item in client.GetProjects()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Project_GetProjects_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevCenterClient client = new DevCenterClient(endpoint, credential); + + await foreach (DevCenterProject item in client.GetProjectsAsync()) + { + } + } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample1_DevCenterClient_HelloWorldAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample1_DevCenterClient_HelloWorldAsync.cs new file mode 100644 index 000000000000..4bed2e5861b5 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample1_DevCenterClient_HelloWorldAsync.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#region Snippet:Azure_DevCenter_BasicImport +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +#endregion +using Azure.Core.TestFramework; +using System.Threading.Tasks; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples : SamplesBase + { + public async Task GetProject() + { + #region Snippet:Azure_DevCenter_CreateDevCenterClient + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + + var devCenterClient = new DevCenterClient(endpoint, credential); + #endregion + + #region Snippet:Azure_DevCenter_GetProjectAsync + DevCenterProject project = await devCenterClient.GetProjectAsync("MyProject"); + Console.WriteLine(project.Name); + #endregion + + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample2_DevBoxesClient_HelloWorldAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample2_DevBoxesClient_HelloWorldAsync.cs new file mode 100644 index 000000000000..12b34c452ae7 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample2_DevBoxesClient_HelloWorldAsync.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using Azure.Core.TestFramework; +using System.Threading.Tasks; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples : SamplesBase + { + public async Task GetDevBox() + { + #region Snippet:Azure_DevCenter_CreateDevBoxesClient + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + + var devBoxesClient = new DevBoxesClient(endpoint, credential); + #endregion + + #region Snippet:Azure_DevCenter_GetDevBoxAsync + DevBox devBox = await devBoxesClient.GetDevBoxAsync("MyProject", "me", "MyDevBox"); + Console.WriteLine($"The dev box {devBox.Name} is located in the {devBox.Location} region."); + #endregion + + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample3_EnvironmentsClient_HelloWorldAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample3_EnvironmentsClient_HelloWorldAsync.cs new file mode 100644 index 000000000000..03c3386efb98 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample3_EnvironmentsClient_HelloWorldAsync.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +using Azure.Core.TestFramework; +using System.Threading.Tasks; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples : SamplesBase + { + public async Task GetEnvironment() + { + #region Snippet:Azure_DevCenter_CreateDeploymentEnvironmentsClient + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + + var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); + #endregion + + #region Snippet:Azure_DevCenter_GetEnvironmentAsync + DevCenterEnvironment environment = await environmentsClient.GetEnvironmentAsync("MyProject", "me", "MyEnvironment"); + Console.WriteLine($"The environment {environment.Name} is in {environment.ProvisioningState} state"); + #endregion + + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample4_CreateDeleteDevBoxAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample4_CreateDeleteDevBoxAsync.cs new file mode 100644 index 000000000000..6191b4eebf6e --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample4_CreateDeleteDevBoxAsync.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#region Snippet:Azure_DevCenter_LongImports +using System; +using System.Collections.Generic; +using System.Linq; +using Azure; +using Azure.Developer.DevCenter; +using Azure.Developer.DevCenter.Models; +using Azure.Identity; +#endregion +using System.Threading.Tasks; +using Azure.Core.TestFramework; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples: SamplesBase + { + public async Task CreateDeleteDevBoxAsync() + { + // Create and delete a Dev Box + #region Snippet:Azure_DevCenter_GetProjects_Scenario + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + var devCenterClient = new DevCenterClient(endpoint, credential); + + List projects = await devCenterClient.GetProjectsAsync().ToEnumerableAsync(); + var projectName = projects.FirstOrDefault().Name; + #endregion + + if (projectName is null) + { + throw new InvalidOperationException($"No valid project resources found in DevCenter {endpoint}."); + } + + #region Snippet:Azure_DevCenter_GetPools_Scenario + // Create DevBox-es client from existing DevCenter client + var devBoxesClient = devCenterClient.GetDevBoxesClient(); + + // Grab a pool + List pools = await devBoxesClient.GetPoolsAsync(projectName).ToEnumerableAsync(); + var poolName = pools.FirstOrDefault().Name; + #endregion + + if (poolName is null) + { + throw new InvalidOperationException($"No valid pool resources found in Project {projectName}/DevCenter {endpoint}."); + } + + // Provision your dev box in the selected pool + #region Snippet:Azure_DevCenter_CreateDevBox_Scenario + var devBoxName = "MyDevBox"; + var devBox = new DevBox(devBoxName, poolName); + + Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( + WaitUntil.Completed, + projectName, + "me", + devBox); + + devBox = await devBoxCreateOperation.WaitForCompletionAsync(); + Console.WriteLine($"Completed provisioning for dev box with status {devBox.ProvisioningState}."); + #endregion + + // Fetch the web connection URL to access your dev box from the browser + #region Snippet:Azure_DevCenter_ConnectToDevBox_Scenario + + RemoteConnection remoteConnection = await devBoxesClient.GetRemoteConnectionAsync( + projectName, + "me", + devBoxName); + + Console.WriteLine($"Connect using web URL {remoteConnection.WebUri}."); + #endregion + + // Delete your dev box when finished + #region Snippet:Azure_DevCenter_DeleteDevBox_Scenario + Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( + WaitUntil.Completed, + projectName, + "me", + devBoxName); + await devBoxDeleteOperation.WaitForCompletionResponseAsync(); + Console.WriteLine($"Completed dev box deletion."); + #endregion + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample5_StopStartRestartDevBoxAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample5_StopStartRestartDevBoxAsync.cs new file mode 100644 index 000000000000..e9f4e633b9fd --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample5_StopStartRestartDevBoxAsync.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples: SamplesBase + { + public async Task StopStartRestartDevBoxAsync() + { + #region Snippet:Azure_DevCenter_GetDevBox_Scenario + // Create DevBox-es client + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + var devBoxesClient = new DevBoxesClient(endpoint, credential); + + //Dev Box properties + var projectName = "MyProject"; + var devBoxName = "MyDevBox"; + var user = "me"; + + // Grab the dev box + DevBox devBox = await devBoxesClient.GetDevBoxAsync(projectName, user, devBoxName); + #endregion + + #region Snippet:Azure_DevCenter_StopDevBox_Scenario + if (devBox.PowerState == PowerState.Running) + { + //Stop the dev box + await devBoxesClient.StopDevBoxAsync( + WaitUntil.Completed, + projectName, + user, + devBoxName); + + Console.WriteLine($"Completed stopping the dev box."); + } + #endregion + + #region Snippet:Azure_DevCenter_StartDevBox_Scenario + //Start the dev box + Operation response = await devBoxesClient.StartDevBoxAsync( + WaitUntil.Started, + projectName, + user, + devBoxName); + + response.WaitForCompletionResponse(); + Console.WriteLine($"Completed starting the dev box."); + + #endregion + + #region Snippet:Azure_DevCenter_RestartDevBox_Scenario + //Restart the dev box + await devBoxesClient.RestartDevBoxAsync( + WaitUntil.Completed, + projectName, + user, + devBoxName); + + Console.WriteLine($"Completed restarting the dev box."); + #endregion + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample6_GetDelaySkipDevBoxActionsAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample6_GetDelaySkipDevBoxActionsAsync.cs new file mode 100644 index 000000000000..ba5fd560e7e3 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample6_GetDelaySkipDevBoxActionsAsync.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples: SamplesBase + { + public async Task Sample_GetDelaySkipActionAsync() + { + #region Snippet:Azure_DevCenter_GetDevBoxAction_Scenario + // Create DevBox-es client + string devCenterUri = "https://8a40af38-3b4c-4672-a6a4-5e964b1870ed-contosodevcenter.centralus.devcenter.azure.com"; + var endpoint = new Uri(devCenterUri); + var credential = new DefaultAzureCredential(); + var devBoxesClient = new DevBoxesClient(endpoint, credential); + + //Dev Box properties + var projectName = "MyProject"; + var devBoxName = "MyDevBox"; + var user = "me"; + + //Get the default schedule action of a dev box + DevBoxAction action = await devBoxesClient.GetDevBoxActionAsync( + projectName, + user, + devBoxName, + "schedule-default"); + #endregion + + #region Snippet:Azure_DevCenter_DelayDevBoxAction_Scenario + //The time an action is scheduled to perform + DateTimeOffset actionTime = action.NextAction.ScheduledTime; + + //Delay an action by 10 min + DateTimeOffset delayUntil = actionTime.AddMinutes(10); + DevBoxAction delayedAction = await devBoxesClient.DelayActionAsync( + projectName, + user, + devBoxName, + action.Name, + delayUntil); + + Console.WriteLine($"Action {action.Name} was delayed until {delayedAction.NextAction.ScheduledTime}."); + #endregion + + #region Snippet:Azure_DevCenter_GetDevBoxActions_Scenario + //List all actions for a dev box + List actions = await devBoxesClient.GetDevBoxActionsAsync(projectName, user, devBoxName).ToEnumerableAsync(); + + //Another way of getting a dev box action + action = actions.Where(x => x.Name == "schedule-default").FirstOrDefault(); + Console.WriteLine($"Action {action.Name} is now schedule to {action.ActionType} at {action.NextAction.ScheduledTime}."); + + //Get the time of the action most in the future + DateTimeOffset latestActionTime = actions.Max(x => x.NextAction.ScheduledTime); + #endregion + + #region Snippet:Azure_DevCenter_DelayAllActions_Scenario + //Delay all actions + DateTimeOffset delayAllActionsUntil = latestActionTime.AddMinutes(10); + await foreach (DevBoxActionDelayResult actionDelayResult in devBoxesClient.DelayAllActionsAsync(projectName, user, devBoxName, delayAllActionsUntil)) + { + if (actionDelayResult.DelayStatus == DevBoxActionDelayStatus.Succeeded) + { + Console.WriteLine($"Action {actionDelayResult.ActionName} was successfully delayed until {actionDelayResult.Action.SuspendedUntil}"); + } + else + { + Console.WriteLine($"Action {actionDelayResult.ActionName} failed to delay"); + } + } + #endregion + + #region Snippet:Azure_DevCenter_SkipAction_Scenario + //Skip the default schedule action + Response skipActionResponse = await devBoxesClient.SkipActionAsync( + projectName, + user, + devBoxName, + "schedule-default"); + + Console.WriteLine($"Skip action finished with status {skipActionResponse.Status}."); + #endregion + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample7_CreateDeleteEnvironmentAsync.cs similarity index 56% rename from sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs rename to sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample7_CreateDeleteEnvironmentAsync.cs index ce7be105d2ad..c2db137984d4 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample7_CreateDeleteEnvironmentAsync.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; +using Azure.Developer.DevCenter.Models; namespace Azure.Developer.DevCenter.Tests.Samples { @@ -17,10 +18,9 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) var credential = new DefaultAzureCredential(); var devCenterClient = new DevCenterClient(endpoint, credential); string projectName = null; - await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null)) + await foreach (DevCenterProject project in devCenterClient.GetProjectsAsync()) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - projectName = result.GetProperty("name").ToString(); + projectName = project.Name; } if (projectName is null) @@ -28,17 +28,19 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) throw new InvalidOperationException($"No valid project resources found in DevCenter {endpoint}."); } - // Create deployment environments client - var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); - #region Snippet:Azure_DevCenter_GetCatalogs_Scenario - string catalogName = null; + // Create deployment environments client from existing DevCenter client + var environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient(); - await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName, null, null)) + //List all catalogs and grab the first one + //Using foreach, but could also use a List + string catalogName = default; + await foreach (DevCenterCatalog catalog in environmentsClient.GetCatalogsAsync(projectName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - catalogName = result.GetProperty("name").ToString(); + catalogName = catalog.Name; + break; } + Console.WriteLine($"Using catalog {catalogName}"); #endregion if (catalogName is null) @@ -47,26 +49,30 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) } #region Snippet:Azure_DevCenter_GetEnvironmentDefinitionsFromCatalog_Scenario - string environmentDefinitionName = null; - await foreach (BinaryData data in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName, maxCount: 1, context: new())) + //List all environment definition for a catalog and grab the first one + string environmentDefinitionName = default; + await foreach (EnvironmentDefinition environmentDefinition in environmentsClient.GetEnvironmentDefinitionsByCatalogAsync(projectName, catalogName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentDefinitionName = result.GetProperty("name").ToString(); + environmentDefinitionName = environmentDefinition.Name; + break; } + Console.WriteLine($"Using environment definition {environmentDefinitionName}"); #endregion if (environmentDefinitionName is null) { - throw new InvalidOperationException($"No valid environemtn definitions were found in Project {projectName}/DevCenter {endpoint}."); + throw new InvalidOperationException($"No valid environment definitions were found in Project {projectName}/DevCenter {endpoint}."); } #region Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario - string environmentTypeName = null; - await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName, null, null)) + //List all environment types and grab the first one + string environmentTypeName = default; + await foreach (DevCenterEnvironmentType environmentType in environmentsClient.GetEnvironmentTypesAsync(projectName)) { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - environmentTypeName = result.GetProperty("name").ToString(); + environmentTypeName = environmentType.Name; + break; } + Console.WriteLine($"Using environment type {environmentTypeName}"); #endregion if (environmentTypeName is null) @@ -75,24 +81,23 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) } #region Snippet:Azure_DevCenter_CreateEnvironment_Scenario - var content = new - { - catalogName = catalogName, - environmentType = environmentTypeName, - environmentDefinitionName = environmentDefinitionName, - }; + var requestEnvironment = new DevCenterEnvironment + ( + "DevEnvironment", + environmentTypeName, + catalogName, + environmentDefinitionName + ); // Deploy the environment - Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( + Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync( WaitUntil.Completed, projectName, "me", - "DevEnvironment", - RequestContent.Create(content)); + requestEnvironment); - BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync(); - JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement; - Console.WriteLine($"Completed provisioning for environment with status {environment.GetProperty("provisioningState")}."); + DevCenterEnvironment environment = await environmentCreateOperation.WaitForCompletionAsync(); + Console.WriteLine($"Completed provisioning for environment with status {environment.ProvisioningState}."); #endregion // Delete the environment when finished diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs index e7042ee9e5ef..19326e974acc 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs @@ -17,6 +17,12 @@ public void CreateClients(Uri endpoint) var devBoxesClient = new DevBoxesClient(endpoint, credential); var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); #endregion + + #region Snippet:Azure_DevCenter_CreateClientsFromDevCenterClient_Scenario + devBoxesClient = devCenterClient.GetDevBoxesClient(); + environmentsClient = devCenterClient.GetDeploymentEnvironmentsClient(); + #endregion + } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteDevBoxAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteDevBoxAsync.cs deleted file mode 100644 index 2ddc583b4bb8..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteDevBoxAsync.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.TestFramework; - -namespace Azure.Developer.DevCenter.Tests.Samples -{ - public partial class DevCenterSamples: SamplesBase - { - public async Task CreateDeleteDevBoxAsync(Uri endpoint) - { - // Create and delete a user devbox - var credential = new DefaultAzureCredential(); - var devCenterClient = new DevCenterClient(endpoint, credential); - - #region Snippet:Azure_DevCenter_GetProjects_Scenario - string targetProjectName = null; - await foreach (BinaryData data in devCenterClient.GetProjectsAsync(null, null, null)) - { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetProjectName = result.GetProperty("name").ToString(); - } - #endregion - - if (targetProjectName is null) - { - throw new InvalidOperationException($"No valid project resources found in DevCenter {endpoint}."); - } - - // Create DevBox-es client - var devBoxesClient = new DevBoxesClient(endpoint, credential); - - // Grab a pool - #region Snippet:Azure_DevCenter_GetPools_Scenario - string targetPoolName = null; - await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName, null, null, null)) - { - JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - targetPoolName = result.GetProperty("name").ToString(); - } - #endregion - - if (targetPoolName is null) - { - throw new InvalidOperationException($"No valid pool resources found in Project {targetProjectName}/DevCenter {endpoint}."); - } - - // Provision your dev box in the selected pool - #region Snippet:Azure_DevCenter_CreateDevBox_Scenario - var content = new - { - poolName = targetPoolName, - }; - - Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync( - WaitUntil.Completed, - targetProjectName, - "me", - "MyDevBox", - RequestContent.Create(content)); - - BinaryData devBoxData = await devBoxCreateOperation.WaitForCompletionAsync(); - JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).RootElement; - Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetProperty("provisioningState")}."); - #endregion - - // Fetch the web connection URL to access your dev box from the browser - #region Snippet:Azure_DevCenter_ConnectToDevBox_Scenario - Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( - targetProjectName, - "me", - "MyDevBox", - null); - JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; - Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); - #endregion - - // Delete your dev box when finished - #region Snippet:Azure_DevCenter_DeleteDevBox_Scenario - Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( - WaitUntil.Completed, - targetProjectName, - "me", - "MyDevBox"); - await devBoxDeleteOperation.WaitForCompletionResponseAsync(); - Console.WriteLine($"Completed dev box deletion."); - #endregion - } - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterClientTestEnvironment.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterClientTestEnvironment.cs new file mode 100644 index 000000000000..55ccae18c5b3 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterClientTestEnvironment.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.Identity; + +namespace Azure.Developer.DevCenter.Tests +{ + public class DevCenterClientTestEnvironment : TestEnvironment + { + private TokenCredential _credential; + public Uri Endpoint => new(GetRecordedVariable("DEVCENTER_ENDPOINT")); + public string ProjectName => GetRecordedVariable("DEFAULT_PROJECT_NAME"); + public string PoolName => GetRecordedVariable("DEFAULT_POOL_NAME"); + public string CatalogName => GetRecordedVariable("DEFAULT_CATALOG_NAME"); + public string EnvironmentTypeName => GetRecordedVariable("DEFAULT_ENVIRONMENT_TYPE_NAME"); + public string UserId => GetRecordedVariable("STATIC_TEST_USER_ID"); + public string MeUserId => "me"; + + public override TokenCredential Credential + { + get + { + if (_credential != null) + { + return _credential; + } + if (Mode == RecordedTestMode.Playback) + { + _credential = new MockCredential(); + } + else + { + return new DevCenterTestUserCredential( + GetVariable("CLIENT_ID"), + GetVariable("CLIENT_SECRET"), + GetVariable("DEFAULT_TEST_USER_SECRET"), + GetVariable("DEFAULT_TEST_USER_NAME"), + GetVariable("DEFAULT_DEVCENTER_SCOPE"), + new(GetVariable("AZURE_AUTHORITY_HOST") ?? AzureAuthorityHosts.AzurePublicCloud.ToString()), + GetVariable("TENANT_ID")); + } + + return _credential; + } + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterTestUserCredential.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterTestUserCredential.cs new file mode 100644 index 000000000000..813b151af191 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/TestEnvironment/DevCenterTestUserCredential.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Microsoft.Identity.Client; + +namespace Azure.Developer.DevCenter.Tests +{ + /// + /// This TokenCredential implementation does the following: + /// 1. Obtains a token for a user using Username/Secret credential against the test principal + /// 2. Uses the access token from 1) to obtain a on-behalf-of (OBO) token to the service + /// + /// This allows us to test user-only scenarios without user interaction. + /// + internal sealed class DevCenterTestUserCredential : TokenCredential + { + private readonly Uri _authority; + private readonly string _clientId; + private readonly string _clientSecret; + private readonly string _userSecret; + private readonly string _userName; + private readonly string[] _dataplaneScopes; + + public DevCenterTestUserCredential(string clientId, string clientSecret, string userSecret, string userName, string dataplaneScope, Uri authorityHost, string tenantId) + { + _clientId = clientId; + _clientSecret = clientSecret; + _userSecret = userSecret; + _userName = userName; + _authority = new(authorityHost, tenantId); + _dataplaneScopes = new string[] { dataplaneScope }; + } + + public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) + { + return GetTokenAsync(requestContext, cancellationToken).GetAwaiter().GetResult(); + } + + public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) + { + IPublicClientApplication publicApp = PublicClientApplicationBuilder.Create(_clientId) + .WithAuthority(_authority) + .Build(); + + AuthenticationResult userAuthentication = await publicApp.AcquireTokenByUsernamePassword(new string[] { $"api://{_clientId}/fidalgotest" }, _userName, _userSecret).ExecuteAsync(); + + IConfidentialClientApplication confidentialApp = ConfidentialClientApplicationBuilder.Create(_clientId) + .WithAuthority(_authority) + .WithClientSecret(_clientSecret) + .Build(); + AuthenticationResult clientOBOAuthentication = await confidentialApp.AcquireTokenOnBehalfOf(_dataplaneScopes, new UserAssertion(userAuthentication.AccessToken)).ExecuteAsync(); + + return new AccessToken(clientOBOAuthentication.AccessToken, clientOBOAuthentication.ExpiresOn); + } + } +} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml b/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml index 45003093712e..7a5dd579bbef 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml +++ b/sdk/devcenter/Azure.Developer.DevCenter/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/devcenter/DevCenter -commit: 6c25bc297c82624cfcbc7758580bcad118e6ffb6 +commit: 016195491a3f909cac2eedfb85488ced4cb02a2d repo: Azure/azure-rest-api-specs -cleanup: true +cleanup: false diff --git a/sdk/devcenter/test-resources.bicep b/sdk/devcenter/test-resources.bicep index eb5d7d4bc696..26ff037b5203 100644 --- a/sdk/devcenter/test-resources.bicep +++ b/sdk/devcenter/test-resources.bicep @@ -18,8 +18,8 @@ var defaultMarketplaceDefinition = 'sdk-devboxdefinition-${uniqueString('devboxd var defaultCatalogName = 'sdk-default-catalog' var defaultScheduleName = 'default' var defaultEnvironmentTypeName = 'sdk-environment-type-${uniqueString('environment-type', '2022-11-11-preview', baseName, resourceGroup().name)}' -var devBoxSkuName = 'general_i_16c64gb1024ssd_v2' -var devBoxStorage = 'ssd_1024gb' +var devBoxSkuName = 'general_i_8c32gb256ssd_v2' +var devBoxStorage = 'ssd_256gb' var marketplaceImageName = 'microsoftvisualstudio_visualstudioplustools_vs-2022-ent-general-win11-m365-gen2' var gitUri = 'https://github.com/Azure/deployment-environments.git' @@ -170,7 +170,7 @@ resource catalog 'Microsoft.DevCenter/devcenters/catalogs@2022-09-01-preview' = gitHub: { branch: 'main' secretIdentifier: catalogPatIdentifier - path: '/NewFormat' + path: '/Environments' uri: gitUri } } diff --git a/sdk/devcenter/tests.yml b/sdk/devcenter/tests.yml index fc002c7c41a2..3a81489b2c5f 100644 --- a/sdk/devcenter/tests.yml +++ b/sdk/devcenter/tests.yml @@ -5,7 +5,8 @@ extends: parameters: ServiceDirectory: devcenter SDKType: client - DeployTestResources: false + DeployTestResources: true + TimeoutInMinutes: 240 CloudConfig: Public: SubscriptionConfiguration: $(sub-config-devcenter-test-resources)