diff --git a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md index 6a57ab762db5..3c4b52320e34 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/CHANGELOG.md @@ -1,14 +1,15 @@ # Release History -## 1.0.0-beta.3 (Unreleased) - -### Features Added +## 1.0.0 (Unreleased) +This release updates the Azure DevCenter library to use the 2023-04-01 GA API. ### Breaking Changes -### Bugs Fixed - -### Other Changes + - `EnvironmentsClient` renamed to `DeploymentEnvironmentsClient` + - `DevBoxesClient` and `DeploymentEnvironmentsClient` no longer accepts project as a constructor parameter + - `DeploymentEnvironmentsClient` now works with "environment definitions" instead of "catalog items" + - Creating a new environment requires passing `environmentDefinitionName` instead of `catalogItemName` + - Creating a new environment requires passing an additional parameter `catalogName` ## 1.0.0-beta.2 (2023-02-07) This release updates the Azure DevCenter library to use the 2022-11-11-preview API. diff --git a/sdk/devcenter/Azure.Developer.DevCenter/README.md b/sdk/devcenter/Azure.Developer.DevCenter/README.md index f0b37f83c8cb..fa0da0f60818 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/README.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/README.md @@ -22,7 +22,7 @@ dotnet add package Azure.Developer.DevCenter --prerelease You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. -You must have [configured](https://learn.microsoft.com/azure/dev-box/quickstart-configure-dev-box-service) a DevCenter, Project, Network Connection, Dev Box Definition, and Pool before you can create Dev Boxes +You must have [configured](https://learn.microsoft.com/azure/dev-box/quickstart-configure-dev-box-service) a DevCenter, Project, Network Connection, Dev Box Definition, and Pool before you can create Dev Boxes You must have configured a DevCenter, Project, Catalog, and Environment Type before you can create Environments @@ -36,19 +36,22 @@ To use Azure Active Directory authentication, add the Azure Identity package: You will also need to register a new AAD application, or run locally or in an environment with a managed identity. If using an application, set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET. -``` -Uri endpoint = new Uri(""); -var client = new DevCenterClient(endpoint, new DefaultAzureCredential()); -``` - ## Key concepts The library uses three main clients. The `DevCenterClient` provides access to common APIs for interacting with projects and listing resources across projects. The `DevBoxesClient` is scoped to a single project, and provides access to Dev Box resources such as Pools and Dev Boxes. -The `EnvironmentsClient` is scoped to a single project, and provides access to Environments resources such as Catalog Items, Environment Types, and Environments. +The `DeploymentEnvironmentsClient` is scoped to a single project, and provides access to Environments resources such as Environment Definitions, Environment Types, and Environments. Use these clients to interact with DevCenter resources based on your scenario. +```C# Snippet:Azure_DevCenter_CreateClients_Scenario +var credential = new DefaultAzureCredential(); + +var devCenterClient = new DevCenterClient(endpoint, credential); +var devBoxesClient = new DevBoxesClient(endpoint, credential); +var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); +``` + ### 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. @@ -68,12 +71,13 @@ We guarantee that all client instance methods are thread-safe and independent of You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/devcenter/Azure.Developer.DevCenter/samples). -### Build a client and get projects +### Get all projects in a dev center + +`DevCenterClient` allows you to list projects and retrieve projects by their name. + ```C# Snippet:Azure_DevCenter_GetProjects_Scenario -var credential = new DefaultAzureCredential(); -var devCenterClient = new DevCenterClient(endpoint, credential); string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(filter: null, maxCount: 1, context: new())) +await foreach (BinaryData data in devCenterClient.GetProjectsAsync()) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; targetProjectName = result.GetProperty("name").ToString(); @@ -81,10 +85,12 @@ await foreach (BinaryData data in devCenterClient.GetProjectsAsync(filter: null, ``` ### List available Dev Box Pools + +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 -var devBoxesClient = new DevBoxesClient(endpoint, targetProjectName, credential); string targetPoolName = null; -await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(filter: null, maxCount: 1, context: new())) +await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; targetPoolName = result.GetProperty("name").ToString(); @@ -92,75 +98,129 @@ await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(filter: null, max ``` ### Provision a Dev Box + +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, }; -Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(WaitUntil.Completed, "me", "MyDevBox", RequestContent.Create(content)); +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 your Dev Box + +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("me", "MyDevBox", new()); +Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( + targetProjectName, + "me", + "MyDevBox"); JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); ``` ### Delete the Dev Box + +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, "me", "MyDevBox"); +Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync( + WaitUntil.Completed, + targetProjectName, + "me", + "MyDevBox"); await devBoxDeleteOperation.WaitForCompletionResponseAsync(); Console.WriteLine($"Completed dev box deletion."); ``` -### Get Catalog Items +## Get project catalogs + +`DeploymentEnvironmentsClient` can be used to issue a request to get all catalogs in a project. -```C# Snippet:Azure_DevCenter_GetCatalogItems_Scenario -var environmentsClient = new EnvironmentsClient(endpoint, projectName, credential); -string catalogItemName = null; -await foreach (BinaryData data in environmentsClient.GetCatalogItemsAsync(maxCount: 1, context: new())) +```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario +string catalogName = null; + +await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - catalogItemName = result.GetProperty("name").ToString(); + catalogName = result.GetProperty("name").ToString(); } ``` -### Get Environment Types +## Get all environment definitions in a project for a catalog + +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())) +{ + 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(maxCount: 1, context: new())) +await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; environmentTypeName = result.GetProperty("name").ToString(); } ``` -### Create an Environment +## 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, - catalogItemName = catalogItemName, + environmentDefinitionName = environmentDefinitionName, }; // Deploy the environment -Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "DevEnvironment", RequestContent.Create(content)); +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 +## Delete an environment + +Issue a request to delete an environment. ```C# Snippet:Azure_DevCenter_DeleteEnvironment_Scenario -Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync(WaitUntil.Completed, projectName, "DevEnvironment"); +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/api/Azure.Developer.DevCenter.netstandard2.0.cs b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs index f2c7d35fd546..bde93d69e681 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,41 +1,78 @@ namespace Azure.Developer.DevCenter { + 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.DevCenterClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { 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, 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 = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetAllEnvironmentsAsync(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetCatalog(string projectName, string catalogName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCatalogAsync(string projectName, string catalogName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetCatalogs(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetCatalogsAsync(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetEnvironment(string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetEnvironmentAsync(string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetEnvironmentDefinition(string projectName, string catalogName, string definitionName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetEnvironmentDefinitionAsync(string projectName, string catalogName, string definitionName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitions(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetEnvironments(string projectName, string userId, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentsAsync(string projectName, string userId, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetEnvironmentTypes(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetEnvironmentTypesAsync(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + } public partial class DevBoxesClient { protected DevBoxesClient() { } - public DevBoxesClient(System.Uri endpoint, string projectName, Azure.Core.TokenCredential credential) { } - public DevBoxesClient(System.Uri endpoint, string projectName, Azure.Core.TokenCredential credential, Azure.Developer.DevCenter.DevCenterClientOptions options) { } + public DevBoxesClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + 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 userId, string devBoxName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateDevBoxAsync(Azure.WaitUntil waitUntil, string userId, string devBoxName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response DelayUpcomingAction(string userId, string devBoxName, string upcomingActionId, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task DelayUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, System.DateTimeOffset delayUntil, Azure.RequestContext context) { throw null; } - public virtual Azure.Operation DeleteDevBox(Azure.WaitUntil waitUntil, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteDevBoxAsync(Azure.WaitUntil waitUntil, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response GetDevBoxByUser(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetDevBoxByUserAsync(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetDevBoxesByUser(string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetDevBoxesByUserAsync(string userId, string filter, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetPool(string poolName, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetPoolAsync(string poolName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetPools(int? maxCount, string filter, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetPoolsAsync(int? maxCount, string filter, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetRemoteConnection(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetRemoteConnectionAsync(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetScheduleByPool(string poolName, string scheduleName, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetScheduleByPoolAsync(string poolName, string scheduleName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetSchedulesByPool(string poolName, int? maxCount, string filter, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetSchedulesByPoolAsync(string poolName, int? maxCount, string filter, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetUpcomingAction(string userId, string devBoxName, string upcomingActionId, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetUpcomingActions(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetUpcomingActionsAsync(string userId, string devBoxName, Azure.RequestContext context) { throw null; } - public virtual Azure.Response SkipUpcomingAction(string userId, string devBoxName, string upcomingActionId, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task SkipUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation StartDevBox(Azure.WaitUntil waitUntil, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task StartDevBoxAsync(Azure.WaitUntil waitUntil, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation StopDevBox(Azure.WaitUntil waitUntil, string userId, string devBoxName, bool? hibernate = default(bool?), Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task StopDevBoxAsync(Azure.WaitUntil waitUntil, string userId, string devBoxName, bool? hibernate = default(bool?), Azure.RequestContext context = null) { 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, 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 until, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset until, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable DelayAllActions(string projectName, string userId, string devBoxName, System.DateTimeOffset until, Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, System.DateTimeOffset until, Azure.RequestContext context = null) { 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.Response GetAction(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetActionAsync(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetActions(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetActionsAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetAllDevBoxes(string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesAsync(string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetAllDevBoxesByUser(string userId, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetAllDevBoxesByUserAsync(string userId, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetDevBox(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetDevBoxAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetDevBoxes(string projectName, string userId, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetDevBoxesAsync(string projectName, string userId, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetPool(string projectName, string poolName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetPoolAsync(string projectName, string poolName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetPools(string projectName, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetPoolsAsync(string projectName, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetRemoteConnection(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRemoteConnectionAsync(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetSchedule(string projectName, string poolName, string scheduleName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetScheduleAsync(string projectName, string poolName, string scheduleName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetSchedules(string projectName, string poolName, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetSchedulesAsync(string projectName, string poolName, string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { 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; } + public virtual System.Threading.Tasks.Task SkipActionAsync(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation StartDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> StartDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation StopDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, bool? hibernate = default(bool?), Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> StopDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, bool? hibernate = default(bool?), Azure.RequestContext context = null) { throw null; } } public partial class DevCenterClient { @@ -43,66 +80,29 @@ protected DevCenterClient() { } public DevCenterClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } 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.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.Response GetProject(string projectName, Azure.RequestContext context) { 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 Azure.Response GetProject(string projectName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task GetProjectAsync(string projectName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetProjects(string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.AsyncPageable GetProjectsAsync(string filter = null, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } } public partial class DevCenterClientOptions : Azure.Core.ClientOptions { - public DevCenterClientOptions(Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion version = Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion.V2022_11_11_Preview) { } + public DevCenterClientOptions(Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion version = Azure.Developer.DevCenter.DevCenterClientOptions.ServiceVersion.V2023_04_01) { } public enum ServiceVersion { - V2022_11_11_Preview = 1, + V2023_04_01 = 1, } } - public partial class EnvironmentsClient - { - protected EnvironmentsClient() { } - public EnvironmentsClient(System.Uri endpoint, string projectName, Azure.Core.TokenCredential credential) { } - public EnvironmentsClient(System.Uri endpoint, string projectName, 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 userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateEnvironmentAsync(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation CustomEnvironmentAction(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task CustomEnvironmentActionAsync(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeleteEnvironment(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeleteEnvironmentAsync(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeployEnvironmentAction(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task DeployEnvironmentActionAsync(Azure.WaitUntil waitUntil, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response GetCatalogItem(string catalogItemId, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetCatalogItemAsync(string catalogItemId, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetCatalogItems(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetCatalogItemsAsync(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetCatalogItemVersion(string catalogItemId, string version, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetCatalogItemVersionAsync(string catalogItemId, string version, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetCatalogItemVersions(string catalogItemId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetCatalogItemVersionsAsync(string catalogItemId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Response GetEnvironmentByUser(string userId, string environmentName, Azure.RequestContext context) { throw null; } - public virtual System.Threading.Tasks.Task GetEnvironmentByUserAsync(string userId, string environmentName, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironments(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentsAsync(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironmentsByUser(string userId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentsByUserAsync(string userId, int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Pageable GetEnvironmentTypes(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.AsyncPageable GetEnvironmentTypesAsync(int? maxCount, Azure.RequestContext context) { throw null; } - public virtual Azure.Response UpdateEnvironment(string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task UpdateEnvironmentAsync(string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - } } namespace Microsoft.Extensions.Azure { public static partial class DeveloperDevCenterClientBuilderExtensions { - public static Azure.Core.Extensions.IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, System.Uri endpoint, string projectName) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + 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 Azure.Core.Extensions.IAzureClientBuilder AddEnvironmentsClient(this TBuilder builder, System.Uri endpoint, string projectName) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } - public static Azure.Core.Extensions.IAzureClientBuilder AddEnvironmentsClient(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 6eb64a0834b5..d20aecaa0560 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_a7ba85686d" + "Tag": "net/devcenter/Azure.Developer.DevCenter_06b6e86958" } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md index 69b05fb64ec9..3c6fc1374e96 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/README.md @@ -12,5 +12,5 @@ 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_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) diff --git a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md index 5997f178fbe0..35596bb1ebba 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteDevBoxAsync.md @@ -7,10 +7,8 @@ To use these samples, you'll first need to set up resources. See [getting starte Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. ```C# Snippet:Azure_DevCenter_GetProjects_Scenario -var credential = new DefaultAzureCredential(); -var devCenterClient = new DevCenterClient(endpoint, credential); string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(filter: null, maxCount: 1, context: new())) +await foreach (BinaryData data in devCenterClient.GetProjectsAsync()) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; targetProjectName = result.GetProperty("name").ToString(); @@ -22,9 +20,8 @@ await foreach (BinaryData data in devCenterClient.GetProjectsAsync(filter: null, Create a `DevBoxesClient` and issue a request to get all pools in a project. ```C# Snippet:Azure_DevCenter_GetPools_Scenario -var devBoxesClient = new DevBoxesClient(endpoint, targetProjectName, credential); string targetPoolName = null; -await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(filter: null, maxCount: 1, context: new())) +await foreach (BinaryData data in devBoxesClient.GetPoolsAsync(targetProjectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; targetPoolName = result.GetProperty("name").ToString(); @@ -41,7 +38,13 @@ var content = new poolName = targetPoolName, }; -Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(WaitUntil.Completed, "me", "MyDevBox", RequestContent.Create(content)); +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")}."); @@ -52,17 +55,24 @@ Console.WriteLine($"Completed provisioning for dev box with status {devBox.GetPr 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("me", "MyDevBox", new()); +Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( + targetProjectName, + "me", + "MyDevBox"); JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); ``` -## Create a dev box +## 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, "me", "MyDevBox"); +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 index b7fbb0d4c936..bc19c4a7ac1a 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/samples/Sample_CreateDeleteEnvironmentAsync.md @@ -7,27 +7,36 @@ To use these samples, you'll first need to set up resources. See [getting starte Create a `DevCenterClient` and issue a request to get all projects the signed-in user can access. ```C# Snippet:Azure_DevCenter_GetProjects_Scenario -var credential = new DefaultAzureCredential(); -var devCenterClient = new DevCenterClient(endpoint, credential); string targetProjectName = null; -await foreach (BinaryData data in devCenterClient.GetProjectsAsync(filter: null, maxCount: 1, context: new())) +await foreach (BinaryData data in devCenterClient.GetProjectsAsync()) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; targetProjectName = result.GetProperty("name").ToString(); } ``` -## Get all catalog items in a project +## Get project catalogs -Create an `EnvironmentsClient` and issue a request to get all catalog items in a project. +Create an `EnvironmentsClient` and issue a request to get all catalogs in a project. -```C# Snippet:Azure_DevCenter_GetCatalogItems_Scenario -var environmentsClient = new EnvironmentsClient(endpoint, projectName, credential); -string catalogItemName = null; -await foreach (BinaryData data in environmentsClient.GetCatalogItemsAsync(maxCount: 1, context: new())) +```C# Snippet:Azure_DevCenter_GetCatalogs_Scenario +string catalogName = null; + +await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName)) +{ + 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; - catalogItemName = result.GetProperty("name").ToString(); + environmentDefinitionName = result.GetProperty("name").ToString(); } ``` @@ -37,7 +46,7 @@ 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(maxCount: 1, context: new())) +await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; environmentTypeName = result.GetProperty("name").ToString(); @@ -46,17 +55,24 @@ await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(ma ## Create an environment -Issue a request to create an environment using a specific catalog item and environment type. +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, - catalogItemName = catalogItemName, + environmentDefinitionName = environmentDefinitionName, }; // Deploy the environment -Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "DevEnvironment", RequestContent.Create(content)); +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")}."); @@ -67,7 +83,11 @@ Console.WriteLine($"Completed provisioning for environment with status {environm Issue a request to delete an environment. ```C# Snippet:Azure_DevCenter_DeleteEnvironment_Scenario -Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync(WaitUntil.Completed, projectName, "DevEnvironment"); +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 97319f713a28..18894dc4a06c 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.3 + 1.0.0 Azure DevCenter $(RequiredTargetFrameworks) true diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/EnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs similarity index 56% rename from sdk/devcenter/Azure.Developer.DevCenter/src/Generated/EnvironmentsClient.cs rename to sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs index 929ed1da9c04..45e29f704ed7 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/EnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs @@ -15,14 +15,13 @@ namespace Azure.Developer.DevCenter { // Data plane generated client. - /// The Environments service client. - public partial class EnvironmentsClient + /// The DeploymentEnvironments service client. + public partial class DeploymentEnvironmentsClient { private static readonly string[] AuthorizationScopes = new string[] { "https://devcenter.azure.com/.default" }; private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; - private readonly string _projectName; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -31,32 +30,27 @@ public partial class EnvironmentsClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; - /// Initializes a new instance of EnvironmentsClient for mocking. - protected EnvironmentsClient() + /// Initializes a new instance of DeploymentEnvironmentsClient for mocking. + protected DeploymentEnvironmentsClient() { } - /// Initializes a new instance of EnvironmentsClient. + /// Initializes a new instance of DeploymentEnvironmentsClient. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. /// A credential used to authenticate to an Azure Service. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public EnvironmentsClient(Uri endpoint, string projectName, TokenCredential credential) : this(endpoint, projectName, credential, new DevCenterClientOptions()) + /// or is null. + public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new DevCenterClientOptions()) { } - /// Initializes a new instance of EnvironmentsClient. + /// Initializes a new instance of DeploymentEnvironmentsClient. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public EnvironmentsClient(Uri endpoint, string projectName, TokenCredential credential, DevCenterClientOptions options) + /// or is null. + public DeploymentEnvironmentsClient(Uri endpoint, TokenCredential credential, DevCenterClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNull(credential, nameof(credential)); options ??= new DevCenterClientOptions(); @@ -64,7 +58,6 @@ public EnvironmentsClient(Uri endpoint, string projectName, TokenCredential cred _tokenCredential = credential; _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); _endpoint = endpoint; - _projectName = projectName; _apiVersion = options.Version; } @@ -78,24 +71,26 @@ public EnvironmentsClient(Uri endpoint, string projectName, TokenCredential cred /// /// /// + /// 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 default value is "me". /// The name of the environment. /// 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetEnvironmentByUserAsync(string userId, string environmentName, RequestContext context) + /// + public virtual async Task GetEnvironmentAsync(string projectName, string userId, string environmentName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetEnvironmentByUser"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetEnvironment"); scope.Start(); try { - using HttpMessage message = CreateGetEnvironmentByUserRequest(userId, environmentName, context); + using HttpMessage message = CreateGetEnvironmentRequest(projectName, userId, environmentName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -115,102 +110,26 @@ public virtual async Task GetEnvironmentByUserAsync(string userId, str /// /// /// + /// 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 default value is "me". /// The name of the environment. /// 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 response returned from the service. - /// - public virtual Response GetEnvironmentByUser(string userId, string environmentName, RequestContext context) - { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetEnvironmentByUser"); - scope.Start(); - try - { - using HttpMessage message = CreateGetEnvironmentByUserRequest(userId, environmentName, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Partially updates an environment - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. - /// The content to send as the body of the request. - /// 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 response returned from the service. - /// - public virtual async Task UpdateEnvironmentAsync(string userId, string environmentName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.UpdateEnvironment"); - scope.Start(); - try - { - using HttpMessage message = CreateUpdateEnvironmentRequest(userId, environmentName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Partially updates an environment - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. - /// The content to send as the body of the request. - /// 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response UpdateEnvironment(string userId, string environmentName, RequestContent content, RequestContext context = null) + /// + public virtual Response GetEnvironment(string projectName, string userId, string environmentName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.UpdateEnvironment"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetEnvironment"); scope.Start(); try { - using HttpMessage message = CreateUpdateEnvironmentRequest(userId, environmentName, content, context); + using HttpMessage message = CreateGetEnvironmentRequest(projectName, userId, environmentName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -221,7 +140,7 @@ public virtual Response UpdateEnvironment(string userId, string environmentName, } /// - /// [Protocol Method] Get a catalog item from a project. + /// [Protocol Method] Gets the specified catalog within the project /// /// /// @@ -230,22 +149,24 @@ public virtual Response UpdateEnvironment(string userId, string environmentName, /// /// /// - /// The unique id of the catalog item. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. /// 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetCatalogItemAsync(string catalogItemId, RequestContext context) + /// + public virtual async Task GetCatalogAsync(string projectName, string catalogName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetCatalogItem"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetCatalog"); scope.Start(); try { - using HttpMessage message = CreateGetCatalogItemRequest(catalogItemId, context); + using HttpMessage message = CreateGetCatalogRequest(projectName, catalogName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -256,7 +177,7 @@ public virtual async Task GetCatalogItemAsync(string catalogItemId, Re } /// - /// [Protocol Method] Get a catalog item from a project. + /// [Protocol Method] Gets the specified catalog within the project /// /// /// @@ -265,22 +186,24 @@ public virtual async Task GetCatalogItemAsync(string catalogItemId, Re /// /// /// - /// The unique id of the catalog item. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. /// 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetCatalogItem(string catalogItemId, RequestContext context) + /// + public virtual Response GetCatalog(string projectName, string catalogName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetCatalogItem"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetCatalog"); scope.Start(); try { - using HttpMessage message = CreateGetCatalogItemRequest(catalogItemId, context); + using HttpMessage message = CreateGetCatalogRequest(projectName, catalogName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -291,7 +214,7 @@ public virtual Response GetCatalogItem(string catalogItemId, RequestContext cont } /// - /// [Protocol Method] Get a specific catalog item version from a project. + /// [Protocol Method] Get an environment definition from a catalog. /// /// /// @@ -300,24 +223,26 @@ public virtual Response GetCatalogItem(string catalogItemId, RequestContext cont /// /// /// - /// The unique id of the catalog item. - /// The version of the catalog item. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. + /// The 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetCatalogItemVersionAsync(string catalogItemId, string version, RequestContext context) + /// + public virtual async Task GetEnvironmentDefinitionAsync(string projectName, string catalogName, string definitionName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + Argument.AssertNotNullOrEmpty(definitionName, nameof(definitionName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetCatalogItemVersion"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetEnvironmentDefinition"); scope.Start(); try { - using HttpMessage message = CreateGetCatalogItemVersionRequest(catalogItemId, version, context); + using HttpMessage message = CreateGetEnvironmentDefinitionRequest(projectName, catalogName, definitionName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -328,7 +253,7 @@ public virtual async Task GetCatalogItemVersionAsync(string catalogIte } /// - /// [Protocol Method] Get a specific catalog item version from a project. + /// [Protocol Method] Get an environment definition from a catalog. /// /// /// @@ -337,24 +262,26 @@ public virtual async Task GetCatalogItemVersionAsync(string catalogIte /// /// /// - /// The unique id of the catalog item. - /// The version of the catalog item. + /// The DevCenter Project upon which to execute operations. + /// The name of the catalog. + /// The 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetCatalogItemVersion(string catalogItemId, string version, RequestContext context) + /// + public virtual Response GetEnvironmentDefinition(string projectName, string catalogName, string definitionName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); - Argument.AssertNotNullOrEmpty(version, nameof(version)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); + Argument.AssertNotNullOrEmpty(definitionName, nameof(definitionName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.GetCatalogItemVersion"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.GetEnvironmentDefinition"); scope.Start(); try { - using HttpMessage message = CreateGetCatalogItemVersionRequest(catalogItemId, version, context); + using HttpMessage message = CreateGetEnvironmentDefinitionRequest(projectName, catalogName, definitionName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -374,16 +301,21 @@ public virtual Response GetCatalogItemVersion(string catalogItemId, string versi /// /// /// + /// 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 GetEnvironmentsAsync(int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetAllEnvironmentsAsync(string projectName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironments", "value", "nextLink", 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); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); } /// @@ -396,16 +328,21 @@ public virtual AsyncPageable GetEnvironmentsAsync(int? maxCount, Req /// /// /// + /// 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 GetEnvironments(int? maxCount, RequestContext context) + /// + public virtual Pageable GetAllEnvironments(string projectName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironments", "value", "nextLink", 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); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetAllEnvironments", "value", "nextLink", context); } /// @@ -418,21 +355,23 @@ public virtual Pageable GetEnvironments(int? maxCount, RequestContex /// /// /// + /// 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 default value is "me". /// 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. + /// 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 GetEnvironmentsByUserAsync(string userId, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentsAsync(string projectName, string userId, int? maxCount = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsByUserRequest(userId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsByUserNextPageRequest(nextLink, userId, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironmentsByUser", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); } /// @@ -445,25 +384,27 @@ public virtual AsyncPageable GetEnvironmentsByUserAsync(string userI /// /// /// + /// 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 default value is "me". /// 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. + /// 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 GetEnvironmentsByUser(string userId, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironments(string projectName, string userId, int? maxCount = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsByUserRequest(userId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsByUserNextPageRequest(nextLink, userId, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironmentsByUser", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentsRequest(projectName, userId, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentsNextPageRequest(nextLink, projectName, userId, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironments", "value", "nextLink", context); } /// - /// [Protocol Method] Lists latest version of all catalog items available for a project. + /// [Protocol Method] Lists all of the catalogs available for a project. /// /// /// @@ -472,20 +413,25 @@ public virtual Pageable GetEnvironmentsByUser(string userId, int? ma /// /// /// + /// 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 GetCatalogItemsAsync(int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetCatalogsAsync(string projectName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogItemsRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogItemsNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetCatalogItems", "value", "nextLink", 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); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); } /// - /// [Protocol Method] Lists latest version of all catalog items available for a project. + /// [Protocol Method] Lists all of the catalogs available for a project. /// /// /// @@ -494,20 +440,25 @@ public virtual AsyncPageable GetCatalogItemsAsync(int? maxCount, Req /// /// /// + /// 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 GetCatalogItems(int? maxCount, RequestContext context) + /// + public virtual Pageable GetCatalogs(string projectName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogItemsRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogItemsNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetCatalogItems", "value", "nextLink", 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); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetCatalogs", "value", "nextLink", context); } /// - /// [Protocol Method] List all versions of a catalog item from a project. + /// [Protocol Method] Lists all environment definitions available for a project. /// /// /// @@ -516,25 +467,25 @@ public virtual Pageable GetCatalogItems(int? maxCount, RequestContex /// /// /// - /// The unique id of the catalog item. + /// 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. + /// 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 GetCatalogItemVersionsAsync(string catalogItemId, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentDefinitionsAsync(string projectName, int? maxCount = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogItemVersionsRequest(catalogItemId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogItemVersionsNextPageRequest(nextLink, catalogItemId, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetCatalogItemVersions", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); } /// - /// [Protocol Method] List all versions of a catalog item from a project. + /// [Protocol Method] Lists all environment definitions available for a project. /// /// /// @@ -543,25 +494,25 @@ public virtual AsyncPageable GetCatalogItemVersionsAsync(string cata /// /// /// - /// The unique id of the catalog item. + /// 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. + /// 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 GetCatalogItemVersions(string catalogItemId, int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironmentDefinitions(string projectName, int? maxCount = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(catalogItemId, nameof(catalogItemId)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCatalogItemVersionsRequest(catalogItemId, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCatalogItemVersionsNextPageRequest(nextLink, catalogItemId, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetCatalogItemVersions", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsRequest(projectName, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsNextPageRequest(nextLink, projectName, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitions", "value", "nextLink", context); } /// - /// [Protocol Method] Lists all environment types configured for a project. + /// [Protocol Method] Lists all environment definitions available within a catalog. /// /// /// @@ -570,20 +521,27 @@ public virtual Pageable GetCatalogItemVersions(string catalogItemId, /// /// /// + /// 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 GetEnvironmentTypesAsync(int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetEnvironmentDefinitionsByCatalogAsync(string projectName, string catalogName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", 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); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); } /// - /// [Protocol Method] Lists all environment types configured for a project. + /// [Protocol Method] Lists all environment definitions available within a catalog. /// /// /// @@ -592,100 +550,27 @@ public virtual AsyncPageable GetEnvironmentTypesAsync(int? maxCount, /// /// /// + /// 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 GetEnvironmentTypes(int? maxCount, RequestContext context) + /// + public virtual Pageable GetEnvironmentDefinitionsByCatalog(string projectName, string catalogName, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Creates or updates an environment. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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 AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. - /// The content to send as the body of the request. - /// 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 representing an asynchronous operation on the service. - /// - public virtual async Task> CreateOrUpdateEnvironmentAsync(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.CreateOrUpdateEnvironment"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateOrUpdateEnvironmentRequest(userId, environmentName, content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.CreateOrUpdateEnvironment", OperationFinalStateVia.OriginalUri, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates an environment. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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 AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. - /// The content to send as the body of the request. - /// 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 representing an asynchronous operation on the service. - /// - public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(catalogName, nameof(catalogName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.CreateOrUpdateEnvironment"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateOrUpdateEnvironmentRequest(userId, environmentName, content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.CreateOrUpdateEnvironment", OperationFinalStateVia.OriginalUri, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentDefinitionsByCatalogRequest(projectName, catalogName, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(nextLink, projectName, catalogName, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentDefinitionsByCatalog", "value", "nextLink", context); } /// - /// [Protocol Method] Deletes an environment and all its associated resources + /// [Protocol Method] Lists all environment types configured for a project. /// /// /// @@ -694,36 +579,25 @@ public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUnt /// /// /// - /// 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 AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. + /// 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. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task DeleteEnvironmentAsync(WaitUntil waitUntil, string userId, string environmentName, RequestContext context = null) + /// 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 = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.DeleteEnvironment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteEnvironmentRequest(userId, environmentName, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); } /// - /// [Protocol Method] Deletes an environment and all its associated resources + /// [Protocol Method] Lists all environment types configured for a project. /// /// /// @@ -732,36 +606,25 @@ public virtual async Task DeleteEnvironmentAsync(WaitUntil waitUntil, /// /// /// - /// 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 AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// The name of the environment. + /// 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. - /// or is null. - /// or is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string userId, string environmentName, RequestContext context = null) + /// 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 = null, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.DeleteEnvironment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteEnvironmentRequest(userId, environmentName, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetEnvironmentTypesRequest(projectName, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetEnvironmentTypesNextPageRequest(nextLink, projectName, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DeploymentEnvironmentsClient.GetEnvironmentTypes", "value", "nextLink", context); } /// - /// [Protocol Method] Executes a deploy action + /// [Protocol Method] Creates or updates an environment. /// /// /// @@ -771,27 +634,29 @@ public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string userId, 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. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of the environment. /// The content to send as the body of the request. /// 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. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task DeployEnvironmentActionAsync(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) + /// + public virtual async Task> CreateOrUpdateEnvironmentAsync(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.DeployEnvironmentAction"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.CreateOrUpdateEnvironment"); scope.Start(); try { - using HttpMessage message = CreateDeployEnvironmentActionRequest(userId, environmentName, content, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.DeployEnvironmentAction", OperationFinalStateVia.OriginalUri, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateCreateOrUpdateEnvironmentRequest(projectName, userId, environmentName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.CreateOrUpdateEnvironment", OperationFinalStateVia.OriginalUri, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -801,7 +666,7 @@ public virtual async Task DeployEnvironmentActionAsync(WaitUntil wait } /// - /// [Protocol Method] Executes a deploy action + /// [Protocol Method] Creates or updates an environment. /// /// /// @@ -811,27 +676,29 @@ public virtual async Task DeployEnvironmentActionAsync(WaitUntil wait /// /// /// 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. The default value is "me". /// The name of the environment. /// The content to send as the body of the request. /// 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. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeployEnvironmentAction(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) + /// + public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.DeployEnvironmentAction"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.CreateOrUpdateEnvironment"); scope.Start(); try { - using HttpMessage message = CreateDeployEnvironmentActionRequest(userId, environmentName, content, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.DeployEnvironmentAction", OperationFinalStateVia.OriginalUri, context, waitUntil); + using HttpMessage message = CreateCreateOrUpdateEnvironmentRequest(projectName, userId, environmentName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.CreateOrUpdateEnvironment", OperationFinalStateVia.OriginalUri, context, waitUntil); } catch (Exception e) { @@ -841,7 +708,7 @@ public virtual Operation DeployEnvironmentAction(WaitUntil waitUntil, string use } /// - /// [Protocol Method] Executes a custom action + /// [Protocol Method] Deletes an environment and all its associated resources /// /// /// @@ -851,27 +718,27 @@ public virtual Operation DeployEnvironmentAction(WaitUntil waitUntil, string use /// /// /// 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. The default value is "me". /// The name of the environment. - /// The content to send as the body of the request. /// 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task CustomEnvironmentActionAsync(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) + /// + public virtual async Task> DeleteEnvironmentAsync(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.CustomEnvironmentAction"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.DeleteEnvironment"); scope.Start(); try { - using HttpMessage message = CreateCustomEnvironmentActionRequest(userId, environmentName, content, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.CustomEnvironmentAction", OperationFinalStateVia.OriginalUri, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateDeleteEnvironmentRequest(projectName, userId, environmentName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -881,7 +748,7 @@ public virtual async Task CustomEnvironmentActionAsync(WaitUntil wait } /// - /// [Protocol Method] Executes a custom action + /// [Protocol Method] Deletes an environment and all its associated resources /// /// /// @@ -891,27 +758,27 @@ public virtual async Task CustomEnvironmentActionAsync(WaitUntil wait /// /// /// 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. The default value is "me". /// The name of the environment. - /// The content to send as the body of the request. /// 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation CustomEnvironmentAction(WaitUntil waitUntil, string userId, string environmentName, RequestContent content, RequestContext context = null) + /// + public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(environmentName, nameof(environmentName)); - Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EnvironmentsClient.CustomEnvironmentAction"); + using var scope = ClientDiagnostics.CreateScope("DeploymentEnvironmentsClient.DeleteEnvironment"); scope.Start(); try { - using HttpMessage message = CreateCustomEnvironmentActionRequest(userId, environmentName, content, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "EnvironmentsClient.CustomEnvironmentAction", OperationFinalStateVia.OriginalUri, context, waitUntil); + using HttpMessage message = CreateDeleteEnvironmentRequest(projectName, userId, environmentName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -920,7 +787,7 @@ public virtual Operation CustomEnvironmentAction(WaitUntil waitUntil, string use } } - internal HttpMessage CreateGetEnvironmentsRequest(int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllEnvironmentsRequest(string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -928,7 +795,7 @@ internal HttpMessage CreateGetEnvironmentsRequest(int? maxCount, RequestContext var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/environments", false); uri.AppendQuery("api-version", _apiVersion, true); if (maxCount != null) @@ -940,7 +807,7 @@ internal HttpMessage CreateGetEnvironmentsRequest(int? maxCount, RequestContext return message; } - internal HttpMessage CreateGetEnvironmentsByUserRequest(string userId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentsRequest(string projectName, string userId, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -948,7 +815,7 @@ internal HttpMessage CreateGetEnvironmentsByUserRequest(string userId, int? maxC var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/environments", false); @@ -962,7 +829,7 @@ internal HttpMessage CreateGetEnvironmentsByUserRequest(string userId, int? maxC return message; } - internal HttpMessage CreateGetEnvironmentByUserRequest(string userId, string environmentName, RequestContext context) + internal HttpMessage CreateGetEnvironmentRequest(string projectName, string userId, string environmentName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -970,7 +837,7 @@ internal HttpMessage CreateGetEnvironmentByUserRequest(string userId, string env var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/environments/", false); @@ -981,15 +848,15 @@ internal HttpMessage CreateGetEnvironmentByUserRequest(string userId, string env return message; } - internal HttpMessage CreateCreateOrUpdateEnvironmentRequest(string userId, string environmentName, RequestContent content, RequestContext context) + internal HttpMessage CreateCreateOrUpdateEnvironmentRequest(string projectName, string userId, string environmentName, RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var message = _pipeline.CreateMessage(context, ResponseClassifier201); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/environments/", false); @@ -1002,15 +869,15 @@ internal HttpMessage CreateCreateOrUpdateEnvironmentRequest(string userId, strin return message; } - internal HttpMessage CreateUpdateEnvironmentRequest(string userId, string environmentName, RequestContent content, RequestContext context) + internal HttpMessage CreateDeleteEnvironmentRequest(string projectName, string userId, string environmentName, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier202204); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/environments/", false); @@ -1018,75 +885,67 @@ internal HttpMessage CreateUpdateEnvironmentRequest(string userId, string enviro uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; return message; } - internal HttpMessage CreateDeleteEnvironmentRequest(string userId, string environmentName, RequestContext context) + internal HttpMessage CreateGetCatalogsRequest(string projectName, int? maxCount, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202204); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(environmentName, true); + 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; } - internal HttpMessage CreateDeployEnvironmentActionRequest(string userId, string environmentName, RequestContent content, RequestContext context) + internal HttpMessage CreateGetCatalogRequest(string projectName, string catalogName, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(environmentName, true); - uri.AppendPath(":deploy", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/catalogs/", false); + uri.AppendPath(catalogName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; return message; } - internal HttpMessage CreateCustomEnvironmentActionRequest(string userId, string environmentName, RequestContent content, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsRequest(string projectName, int? maxCount, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/environments/", false); - uri.AppendPath(environmentName, true); - uri.AppendPath(":custom", false); + 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"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; return message; } - internal HttpMessage CreateGetCatalogItemsRequest(int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogRequest(string projectName, string catalogName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1094,8 +953,10 @@ internal HttpMessage CreateGetCatalogItemsRequest(int? maxCount, RequestContext var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/catalogItems", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/catalogs/", false); + uri.AppendPath(catalogName, true); + uri.AppendPath("/environmentDefinitions", false); uri.AppendQuery("api-version", _apiVersion, true); if (maxCount != null) { @@ -1106,7 +967,7 @@ internal HttpMessage CreateGetCatalogItemsRequest(int? maxCount, RequestContext return message; } - internal HttpMessage CreateGetCatalogItemRequest(string catalogItemId, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionRequest(string projectName, string catalogName, string definitionName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1114,16 +975,18 @@ internal HttpMessage CreateGetCatalogItemRequest(string catalogItemId, RequestCo var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/catalogItems/", false); - uri.AppendPath(catalogItemId, true); + uri.AppendPath(projectName, true); + uri.AppendPath("/catalogs/", false); + uri.AppendPath(catalogName, true); + uri.AppendPath("/environmentDefinitions/", false); + uri.AppendPath(definitionName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetCatalogItemVersionsRequest(string catalogItemId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentTypesRequest(string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1131,10 +994,8 @@ internal HttpMessage CreateGetCatalogItemVersionsRequest(string catalogItemId, i var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/catalogItems/", false); - uri.AppendPath(catalogItemId, true); - uri.AppendPath("/versions", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/environmentTypes", false); uri.AppendQuery("api-version", _apiVersion, true); if (maxCount != null) { @@ -1145,46 +1006,20 @@ internal HttpMessage CreateGetCatalogItemVersionsRequest(string catalogItemId, i return message; } - internal HttpMessage CreateGetCatalogItemVersionRequest(string catalogItemId, string version, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/catalogItems/", false); - uri.AppendPath(catalogItemId, true); - uri.AppendPath("/versions/", false); - uri.AppendPath(version, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetEnvironmentTypesRequest(int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllEnvironmentsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); - uri.AppendPath("/environmentTypes", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, true); - } + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, string projectName, string userId, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1197,7 +1032,7 @@ internal HttpMessage CreateGetEnvironmentsNextPageRequest(string nextLink, int? return message; } - internal HttpMessage CreateGetEnvironmentsByUserNextPageRequest(string nextLink, string userId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetCatalogsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1210,7 +1045,7 @@ internal HttpMessage CreateGetEnvironmentsByUserNextPageRequest(string nextLink, return message; } - internal HttpMessage CreateGetCatalogItemsNextPageRequest(string nextLink, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1223,7 +1058,7 @@ internal HttpMessage CreateGetCatalogItemsNextPageRequest(string nextLink, int? return message; } - internal HttpMessage CreateGetCatalogItemVersionsNextPageRequest(string nextLink, string catalogItemId, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentDefinitionsByCatalogNextPageRequest(string nextLink, string projectName, string catalogName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1236,7 +1071,7 @@ internal HttpMessage CreateGetCatalogItemVersionsNextPageRequest(string nextLink return message; } - internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, int? maxCount, RequestContext context) + internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, string projectName, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1251,11 +1086,9 @@ internal HttpMessage CreateGetEnvironmentTypesNextPageRequest(string nextLink, i private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - private static ResponseClassifier _responseClassifier200201; - private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); - private static ResponseClassifier _responseClassifier200202204; - private static ResponseClassifier ResponseClassifier200202204 => _responseClassifier200202204 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202, 204 }); - private static ResponseClassifier _responseClassifier200202; - private static ResponseClassifier ResponseClassifier200202 => _responseClassifier200202 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202 }); + private static ResponseClassifier _responseClassifier201; + private static ResponseClassifier ResponseClassifier201 => _responseClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 }); + private static ResponseClassifier _responseClassifier202204; + private static ResponseClassifier ResponseClassifier202204 => _responseClassifier202204 ??= new StatusCodeClassifier(stackalloc ushort[] { 202, 204 }); } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs index 24e85cd31a38..cd32b90fe447 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs @@ -22,7 +22,6 @@ public partial class DevBoxesClient private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; - private readonly string _projectName; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -38,25 +37,20 @@ protected DevBoxesClient() /// Initializes a new instance of DevBoxesClient. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. /// A credential used to authenticate to an Azure Service. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public DevBoxesClient(Uri endpoint, string projectName, TokenCredential credential) : this(endpoint, projectName, credential, new DevCenterClientOptions()) + /// or is null. + public DevBoxesClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new DevCenterClientOptions()) { } /// Initializes a new instance of DevBoxesClient. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. - /// , or is null. - /// is an empty string, and was expected to be non-empty. - public DevBoxesClient(Uri endpoint, string projectName, TokenCredential credential, DevCenterClientOptions options) + /// or is null. + public DevBoxesClient(Uri endpoint, TokenCredential credential, DevCenterClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNull(credential, nameof(credential)); options ??= new DevCenterClientOptions(); @@ -64,7 +58,6 @@ public DevBoxesClient(Uri endpoint, string projectName, TokenCredential credenti _tokenCredential = credential; _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); _endpoint = endpoint; - _projectName = projectName; _apiVersion = options.Version; } @@ -78,22 +71,24 @@ public DevBoxesClient(Uri endpoint, string projectName, TokenCredential credenti /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. /// 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetPoolAsync(string poolName, RequestContext context) + /// + public virtual async Task GetPoolAsync(string projectName, string poolName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetPool"); scope.Start(); try { - using HttpMessage message = CreateGetPoolRequest(poolName, context); + using HttpMessage message = CreateGetPoolRequest(projectName, poolName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -113,22 +108,24 @@ public virtual async Task GetPoolAsync(string poolName, RequestContext /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. /// 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. + /// or is null. + /// or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetPool(string poolName, RequestContext context) + /// + public virtual Response GetPool(string projectName, string poolName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetPool"); scope.Start(); try { - using HttpMessage message = CreateGetPoolRequest(poolName, context); + using HttpMessage message = CreateGetPoolRequest(projectName, poolName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -148,24 +145,26 @@ public virtual Response GetPool(string poolName, RequestContext context) /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetScheduleByPoolAsync(string poolName, string scheduleName, RequestContext context) + /// + public virtual async Task GetScheduleAsync(string projectName, string poolName, string scheduleName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetScheduleByPool"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetSchedule"); scope.Start(); try { - using HttpMessage message = CreateGetScheduleByPoolRequest(poolName, scheduleName, context); + using HttpMessage message = CreateGetScheduleRequest(projectName, poolName, scheduleName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -185,24 +184,26 @@ public virtual async Task GetScheduleByPoolAsync(string poolName, stri /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetScheduleByPool(string poolName, string scheduleName, RequestContext context) + /// + public virtual Response GetSchedule(string projectName, string poolName, string scheduleName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); Argument.AssertNotNullOrEmpty(scheduleName, nameof(scheduleName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetScheduleByPool"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetSchedule"); scope.Start(); try { - using HttpMessage message = CreateGetScheduleByPoolRequest(poolName, scheduleName, context); + using HttpMessage message = CreateGetScheduleRequest(projectName, poolName, scheduleName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -222,24 +223,26 @@ public virtual Response GetScheduleByPool(string poolName, string scheduleName, /// /// /// + /// 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 default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetDevBoxByUserAsync(string userId, string devBoxName, RequestContext context) + /// + public virtual async Task GetDevBoxAsync(string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetDevBoxByUser"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetDevBox"); scope.Start(); try { - using HttpMessage message = CreateGetDevBoxByUserRequest(userId, devBoxName, context); + using HttpMessage message = CreateGetDevBoxRequest(projectName, userId, devBoxName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -259,24 +262,26 @@ public virtual async Task GetDevBoxByUserAsync(string userId, string d /// /// /// + /// 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 default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetDevBoxByUser(string userId, string devBoxName, RequestContext context) + /// + public virtual Response GetDevBox(string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetDevBoxByUser"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetDevBox"); scope.Start(); try { - using HttpMessage message = CreateGetDevBoxByUserRequest(userId, devBoxName, context); + using HttpMessage message = CreateGetDevBoxRequest(projectName, userId, devBoxName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -296,16 +301,18 @@ public virtual Response GetDevBoxByUser(string userId, string devBoxName, Reques /// /// /// + /// 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 default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetRemoteConnectionAsync(string userId, string devBoxName, RequestContext context) + /// + public virtual async Task GetRemoteConnectionAsync(string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -313,7 +320,7 @@ public virtual async Task GetRemoteConnectionAsync(string userId, stri scope.Start(); try { - using HttpMessage message = CreateGetRemoteConnectionRequest(userId, devBoxName, context); + using HttpMessage message = CreateGetRemoteConnectionRequest(projectName, userId, devBoxName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -333,16 +340,18 @@ public virtual async Task GetRemoteConnectionAsync(string userId, stri /// /// /// + /// 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 default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetRemoteConnection(string userId, string devBoxName, RequestContext context) + /// + public virtual Response GetRemoteConnection(string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -350,7 +359,7 @@ public virtual Response GetRemoteConnection(string userId, string devBoxName, Re scope.Start(); try { - using HttpMessage message = CreateGetRemoteConnectionRequest(userId, devBoxName, context); + using HttpMessage message = CreateGetRemoteConnectionRequest(projectName, userId, devBoxName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -361,7 +370,7 @@ public virtual Response GetRemoteConnection(string userId, string devBoxName, Re } /// - /// [Protocol Method] Gets an Upcoming Action. + /// [Protocol Method] Gets an action. /// /// /// @@ -370,26 +379,28 @@ public virtual Response GetRemoteConnection(string userId, string devBoxName, Re /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. + /// The name of an action that will take place on a 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. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, RequestContext context) + /// + public virtual async Task GetActionAsync(string projectName, string userId, string devBoxName, string actionName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetAction"); scope.Start(); try { - using HttpMessage message = CreateGetUpcomingActionRequest(userId, devBoxName, upcomingActionId, context); + using HttpMessage message = CreateGetActionRequest(projectName, userId, devBoxName, actionName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -400,7 +411,7 @@ public virtual async Task GetUpcomingActionAsync(string userId, string } /// - /// [Protocol Method] Gets an Upcoming Action. + /// [Protocol Method] Gets an action. /// /// /// @@ -409,26 +420,28 @@ public virtual async Task GetUpcomingActionAsync(string userId, string /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. + /// The name of an action that will take place on a 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. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetUpcomingAction(string userId, string devBoxName, string upcomingActionId, RequestContext context) + /// + public virtual Response GetAction(string projectName, string userId, string devBoxName, string actionName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.GetAction"); scope.Start(); try { - using HttpMessage message = CreateGetUpcomingActionRequest(userId, devBoxName, upcomingActionId, context); + using HttpMessage message = CreateGetActionRequest(projectName, userId, devBoxName, actionName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -439,7 +452,7 @@ public virtual Response GetUpcomingAction(string userId, string devBoxName, stri } /// - /// [Protocol Method] Skips an Upcoming Action. + /// [Protocol Method] Skips an occurrence of an action. /// /// /// @@ -448,26 +461,28 @@ public virtual Response GetUpcomingAction(string userId, string devBoxName, stri /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. + /// The name of an action that will take place on a 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. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task SkipUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, RequestContext context = null) + /// + public virtual async Task SkipActionAsync(string projectName, string userId, string devBoxName, string actionName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.SkipUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.SkipAction"); scope.Start(); try { - using HttpMessage message = CreateSkipUpcomingActionRequest(userId, devBoxName, upcomingActionId, context); + using HttpMessage message = CreateSkipActionRequest(projectName, userId, devBoxName, actionName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -478,7 +493,7 @@ public virtual async Task SkipUpcomingActionAsync(string userId, strin } /// - /// [Protocol Method] Skips an Upcoming Action. + /// [Protocol Method] Skips an occurrence of an action. /// /// /// @@ -487,26 +502,28 @@ public virtual async Task SkipUpcomingActionAsync(string userId, strin /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. + /// The name of an action that will take place on a 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. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response SkipUpcomingAction(string userId, string devBoxName, string upcomingActionId, RequestContext context = null) + /// + public virtual Response SkipAction(string projectName, string userId, string devBoxName, string actionName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.SkipUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.SkipAction"); scope.Start(); try { - using HttpMessage message = CreateSkipUpcomingActionRequest(userId, devBoxName, upcomingActionId, context); + using HttpMessage message = CreateSkipActionRequest(projectName, userId, devBoxName, actionName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -517,7 +534,7 @@ public virtual Response SkipUpcomingAction(string userId, string devBoxName, str } /// - /// [Protocol Method] Delays an Upcoming Action. + /// [Protocol Method] Delays the occurrence of an action. /// /// /// @@ -526,27 +543,29 @@ public virtual Response SkipUpcomingAction(string userId, string devBoxName, str /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. - /// The delayed action time (UTC). + /// The name of an action that will take place on a 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. - /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DelayUpcomingActionAsync(string userId, string devBoxName, string upcomingActionId, DateTimeOffset delayUntil, RequestContext context) + /// + public virtual async Task DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, DateTimeOffset until, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.DelayUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.DelayAction"); scope.Start(); try { - using HttpMessage message = CreateDelayUpcomingActionRequest(userId, devBoxName, upcomingActionId, delayUntil, context); + using HttpMessage message = CreateDelayActionRequest(projectName, userId, devBoxName, actionName, until, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -557,7 +576,7 @@ public virtual async Task DelayUpcomingActionAsync(string userId, stri } /// - /// [Protocol Method] Delays an Upcoming Action. + /// [Protocol Method] Delays the occurrence of an action. /// /// /// @@ -566,27 +585,29 @@ public virtual async Task DelayUpcomingActionAsync(string userId, stri /// /// /// + /// 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 default value is "me". /// The name of a Dev Box. - /// The upcoming action id. - /// The delayed action time (UTC). + /// The name of an action that will take place on a 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. - /// , or is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DelayUpcomingAction(string userId, string devBoxName, string upcomingActionId, DateTimeOffset delayUntil, RequestContext context) + /// + public virtual Response DelayAction(string projectName, string userId, string devBoxName, string actionName, DateTimeOffset until, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - Argument.AssertNotNullOrEmpty(upcomingActionId, nameof(upcomingActionId)); + Argument.AssertNotNullOrEmpty(actionName, nameof(actionName)); - using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.DelayUpcomingAction"); + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.DelayAction"); scope.Start(); try { - using HttpMessage message = CreateDelayUpcomingActionRequest(userId, devBoxName, upcomingActionId, delayUntil, context); + using HttpMessage message = CreateDelayActionRequest(projectName, userId, devBoxName, actionName, until, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -606,16 +627,21 @@ public virtual Response DelayUpcomingAction(string userId, string devBoxName, st /// /// /// - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// 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'. /// 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(int? maxCount, string filter, RequestContext context) + /// + public virtual AsyncPageable GetPoolsAsync(string projectName, string filter = null, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(maxCount, filter, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, maxCount, filter, 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); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); } @@ -629,16 +655,21 @@ public virtual AsyncPageable GetPoolsAsync(int? maxCount, string fil /// /// /// - /// The maximum number of resources to return from the operation. Example: 'top=10'. + /// 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'. /// 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(int? maxCount, string filter, RequestContext context) + /// + public virtual Pageable GetPools(string projectName, string filter = null, int? maxCount = null, RequestContext context = null) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoolsRequest(maxCount, filter, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoolsNextPageRequest(nextLink, maxCount, filter, 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); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetPools", "value", "nextLink", context); } @@ -652,22 +683,24 @@ public virtual Pageable GetPools(int? maxCount, string filter, Reque /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// 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. + /// 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 GetSchedulesByPoolAsync(string poolName, int? maxCount, string filter, RequestContext context) + /// + public virtual AsyncPageable GetSchedulesAsync(string projectName, string poolName, string filter = null, int? maxCount = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesByPoolRequest(poolName, maxCount, filter, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesByPoolNextPageRequest(nextLink, poolName, maxCount, filter, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedulesByPool", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, filter, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); } /// @@ -680,26 +713,74 @@ public virtual AsyncPageable GetSchedulesByPoolAsync(string poolName /// /// /// + /// The DevCenter Project upon which to execute operations. /// The name of a pool of Dev Boxes. - /// The maximum number of resources to return from the operation. Example: 'top=10'. /// 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. + /// 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 GetSchedulesByPool(string poolName, int? maxCount, string filter, RequestContext context) + /// + public virtual Pageable GetSchedules(string projectName, string poolName, string filter = null, int? maxCount = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(poolName, nameof(poolName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesByPoolRequest(poolName, maxCount, filter, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesByPoolNextPageRequest(nextLink, poolName, maxCount, filter, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedulesByPool", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSchedulesRequest(projectName, poolName, filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSchedulesNextPageRequest(nextLink, projectName, poolName, filter, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetSchedules", "value", "nextLink", context); } /// - /// [Protocol Method] Lists Dev Boxes in the project for a particular user. + /// [Protocol Method] Lists Dev Boxes that the caller has access to in the DevCenter. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 = null, int? maxCount = null, RequestContext context = null) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists Dev Boxes that the caller has access to in the DevCenter. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 = null, int? maxCount = null, RequestContext context = null) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxes", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists Dev Boxes in the Dev Center for a particular user. /// /// /// @@ -716,18 +797,18 @@ public virtual Pageable GetSchedulesByPool(string poolName, int? max /// 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 GetDevBoxesByUserAsync(string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual AsyncPageable GetAllDevBoxesByUserAsync(string userId, string filter = null, int? maxCount = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesByUserRequest(userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxesByUser", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); } /// - /// [Protocol Method] Lists Dev Boxes in the project for a particular user. + /// [Protocol Method] Lists Dev Boxes in the Dev Center for a particular user. /// /// /// @@ -744,18 +825,18 @@ public virtual AsyncPageable GetDevBoxesByUserAsync(string userId, s /// 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 GetDevBoxesByUser(string userId, string filter, int? maxCount, RequestContext context) + /// + public virtual Pageable GetAllDevBoxesByUser(string userId, string filter = null, int? maxCount = null, RequestContext context = null) { Argument.AssertNotNullOrEmpty(userId, nameof(userId)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDevBoxesByUserRequest(userId, filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxesByUser", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesByUserRequest(userId, filter, maxCount, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesByUserNextPageRequest(nextLink, userId, filter, maxCount, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetAllDevBoxesByUser", "value", "nextLink", context); } /// - /// [Protocol Method] Lists upcoming actions on a Dev Box. + /// [Protocol Method] Lists Dev Boxes in the project for a particular user. /// /// /// @@ -764,26 +845,149 @@ public virtual Pageable GetDevBoxesByUser(string userId, string filt /// /// /// + /// 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 default value is "me". + /// 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 = null, int? maxCount = null, RequestContext context = null) + { + 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); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists Dev Boxes in the project for a particular user. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 default value is "me". + /// 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 = null, int? maxCount = null, RequestContext context = null) + { + 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); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetDevBoxes", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists actions on a Dev Box. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 default value is "me". + /// The name of a 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. + /// 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 GetActionsAsync(string projectName, string userId, string devBoxName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetActionsRequest(projectName, userId, devBoxName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetActionsNextPageRequest(nextLink, projectName, userId, devBoxName, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetActions", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Lists actions on a Dev Box. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 default value is "me". /// The name of a 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. + /// , 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 GetActions(string projectName, string userId, string devBoxName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetActionsRequest(projectName, userId, devBoxName, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetActionsNextPageRequest(nextLink, projectName, userId, devBoxName, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetActions", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Delays all actions. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 default value is "me". + /// The name of a 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. + /// , 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 GetUpcomingActionsAsync(string userId, string devBoxName, RequestContext context) + /// + public virtual AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, DateTimeOffset until, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetUpcomingActionsRequest(userId, devBoxName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetUpcomingActionsNextPageRequest(nextLink, userId, devBoxName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetUpcomingActions", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateDelayAllActionsRequest(projectName, userId, devBoxName, until, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateDelayAllActionsNextPageRequest(nextLink, projectName, userId, devBoxName, until, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.DelayAllActions", "value", "nextLink", context); } /// - /// [Protocol Method] Lists upcoming actions on a Dev Box. + /// [Protocol Method] Delays all actions. /// /// /// @@ -792,26 +996,29 @@ public virtual AsyncPageable GetUpcomingActionsAsync(string userId, /// /// /// + /// 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 default value is "me". /// The name of a 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. - /// or is an empty string, and was expected to be non-empty. + /// , 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 GetUpcomingActions(string userId, string devBoxName, RequestContext context) + /// + public virtual Pageable DelayAllActions(string projectName, string userId, string devBoxName, DateTimeOffset until, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetUpcomingActionsRequest(userId, devBoxName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetUpcomingActionsNextPageRequest(nextLink, userId, devBoxName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.GetUpcomingActions", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateDelayAllActionsRequest(projectName, userId, devBoxName, until, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateDelayAllActionsNextPageRequest(nextLink, projectName, userId, devBoxName, until, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevBoxesClient.DelayAllActions", "value", "nextLink", context); } /// - /// [Protocol Method] Creates or updates a Dev Box. + /// [Protocol Method] Creates or replaces a Dev Box. /// /// /// @@ -821,17 +1028,19 @@ public virtual Pageable GetUpcomingActions(string userId, string dev /// /// /// 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. The default value is "me". /// The name of a Dev Box. /// The content to send as the body of the request. /// 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. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task> CreateDevBoxAsync(WaitUntil waitUntil, string userId, string devBoxName, RequestContent content, RequestContext context = null) + /// + public virtual async Task> CreateDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); Argument.AssertNotNull(content, nameof(content)); @@ -840,7 +1049,7 @@ public virtual async Task> CreateDevBoxAsync(WaitUntil wai scope.Start(); try { - using HttpMessage message = CreateCreateDevBoxRequest(userId, devBoxName, content, context); + using HttpMessage message = CreateCreateDevBoxRequest(projectName, userId, devBoxName, content, context); return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.CreateDevBox", OperationFinalStateVia.OriginalUri, context, waitUntil).ConfigureAwait(false); } catch (Exception e) @@ -851,7 +1060,7 @@ public virtual async Task> CreateDevBoxAsync(WaitUntil wai } /// - /// [Protocol Method] Creates or updates a Dev Box. + /// [Protocol Method] Creates or replaces a Dev Box. /// /// /// @@ -861,17 +1070,19 @@ 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 AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of a Dev Box. /// The content to send as the body of the request. /// 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. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation CreateDevBox(WaitUntil waitUntil, string userId, string devBoxName, RequestContent content, RequestContext context = null) + /// + public virtual Operation CreateDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContent content, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); Argument.AssertNotNull(content, nameof(content)); @@ -880,7 +1091,7 @@ public virtual Operation CreateDevBox(WaitUntil waitUntil, string us scope.Start(); try { - using HttpMessage message = CreateCreateDevBoxRequest(userId, devBoxName, content, context); + using HttpMessage message = CreateCreateDevBoxRequest(projectName, userId, devBoxName, content, context); return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.CreateDevBox", OperationFinalStateVia.OriginalUri, context, waitUntil); } catch (Exception e) @@ -901,16 +1112,18 @@ public virtual Operation CreateDevBox(WaitUntil waitUntil, string us /// /// /// 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. The default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task DeleteDevBoxAsync(WaitUntil waitUntil, string userId, string devBoxName, RequestContext context = null) + /// + public virtual async Task> DeleteDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -918,8 +1131,8 @@ public virtual async Task DeleteDevBoxAsync(WaitUntil waitUntil, stri scope.Start(); try { - using HttpMessage message = CreateDeleteDevBoxRequest(userId, devBoxName, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateDeleteDevBoxRequest(projectName, userId, devBoxName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -939,16 +1152,18 @@ public virtual async Task DeleteDevBoxAsync(WaitUntil waitUntil, stri /// /// /// 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. The default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeleteDevBox(WaitUntil waitUntil, string userId, string devBoxName, RequestContext context = null) + /// + public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -956,8 +1171,8 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string userId, string scope.Start(); try { - using HttpMessage message = CreateDeleteDevBoxRequest(userId, devBoxName, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateDeleteDevBoxRequest(projectName, userId, devBoxName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -977,16 +1192,18 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string userId, 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. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task StartDevBoxAsync(WaitUntil waitUntil, string userId, string devBoxName, RequestContext context = null) + /// + public virtual async Task> StartDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -994,8 +1211,8 @@ public virtual async Task StartDevBoxAsync(WaitUntil waitUntil, strin scope.Start(); try { - using HttpMessage message = CreateStartDevBoxRequest(userId, devBoxName, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StartDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateStartDevBoxRequest(projectName, userId, devBoxName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StartDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1015,16 +1232,18 @@ 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. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of a 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. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation StartDevBox(WaitUntil waitUntil, string userId, string devBoxName, RequestContext context = null) + /// + public virtual Operation StartDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -1032,8 +1251,8 @@ public virtual Operation StartDevBox(WaitUntil waitUntil, string userId, string scope.Start(); try { - using HttpMessage message = CreateStartDevBoxRequest(userId, devBoxName, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StartDevBox", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateStartDevBoxRequest(projectName, userId, devBoxName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StartDevBox", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -1053,17 +1272,19 @@ public virtual Operation StartDevBox(WaitUntil waitUntil, string userId, 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. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of a 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. - /// or is an empty string, and was expected to be non-empty. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task StopDevBoxAsync(WaitUntil waitUntil, string userId, string devBoxName, bool? hibernate = null, RequestContext context = null) + /// + public virtual async Task> StopDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, bool? hibernate = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -1071,8 +1292,8 @@ public virtual async Task StopDevBoxAsync(WaitUntil waitUntil, string scope.Start(); try { - using HttpMessage message = CreateStopDevBoxRequest(userId, devBoxName, hibernate, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StopDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateStopDevBoxRequest(projectName, userId, devBoxName, hibernate, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StopDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1092,17 +1313,19 @@ 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. /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". /// The name of a 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. - /// or is an empty string, and was expected to be non-empty. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation StopDevBox(WaitUntil waitUntil, string userId, string devBoxName, bool? hibernate = null, RequestContext context = null) + /// + public virtual Operation StopDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, bool? hibernate = null, RequestContext context = null) { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); @@ -1110,8 +1333,88 @@ public virtual Operation StopDevBox(WaitUntil waitUntil, string userId, string d scope.Start(); try { - using HttpMessage message = CreateStopDevBoxRequest(userId, devBoxName, hibernate, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StopDevBox", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateStopDevBoxRequest(projectName, userId, devBoxName, hibernate, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.StopDevBox", OperationFinalStateVia.Location, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Restarts a Dev Box + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. The default value is "me". + /// The name of a 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. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> RestartDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.RestartDevBox"); + scope.Start(); + try + { + using HttpMessage message = CreateRestartDevBoxRequest(projectName, userId, devBoxName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.RestartDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Restarts a Dev Box + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. The default value is "me". + /// The name of a 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. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation RestartDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); + Argument.AssertNotNullOrEmpty(userId, nameof(userId)); + Argument.AssertNotNullOrEmpty(devBoxName, nameof(devBoxName)); + + using var scope = ClientDiagnostics.CreateScope("DevBoxesClient.RestartDevBox"); + scope.Start(); + try + { + using HttpMessage message = CreateRestartDevBoxRequest(projectName, userId, devBoxName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.RestartDevBox", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { @@ -1120,7 +1423,7 @@ public virtual Operation StopDevBox(WaitUntil waitUntil, string userId, string d } } - internal HttpMessage CreateGetPoolsRequest(int? maxCount, string filter, RequestContext context) + internal HttpMessage CreateGetPoolsRequest(string projectName, string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1128,23 +1431,23 @@ internal HttpMessage CreateGetPoolsRequest(int? maxCount, string filter, Request var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/pools", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, 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 CreateGetPoolRequest(string poolName, RequestContext context) + internal HttpMessage CreateGetPoolRequest(string projectName, string poolName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1152,7 +1455,7 @@ internal HttpMessage CreateGetPoolRequest(string poolName, RequestContext contex var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/pools/", false); uri.AppendPath(poolName, true); uri.AppendQuery("api-version", _apiVersion, true); @@ -1161,7 +1464,7 @@ internal HttpMessage CreateGetPoolRequest(string poolName, RequestContext contex return message; } - internal HttpMessage CreateGetSchedulesByPoolRequest(string poolName, int? maxCount, string filter, RequestContext context) + internal HttpMessage CreateGetSchedulesRequest(string projectName, string poolName, string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1169,25 +1472,25 @@ internal HttpMessage CreateGetSchedulesByPoolRequest(string poolName, int? maxCo var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/pools/", false); uri.AppendPath(poolName, true); uri.AppendPath("/schedules", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxCount != null) - { - uri.AppendQuery("top", maxCount.Value, 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 CreateGetScheduleByPoolRequest(string poolName, string scheduleName, RequestContext context) + internal HttpMessage CreateGetScheduleRequest(string projectName, string poolName, string scheduleName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1195,7 +1498,7 @@ internal HttpMessage CreateGetScheduleByPoolRequest(string poolName, string sche var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/pools/", false); uri.AppendPath(poolName, true); uri.AppendPath("/schedules/", false); @@ -1206,7 +1509,53 @@ internal HttpMessage CreateGetScheduleByPoolRequest(string poolName, string sche return message; } - internal HttpMessage CreateGetDevBoxesByUserRequest(string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetAllDevBoxesRequest(string filter, int? maxCount, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + 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) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/users/", false); + 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) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1214,7 +1563,7 @@ internal HttpMessage CreateGetDevBoxesByUserRequest(string userId, string filter var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes", false); @@ -1232,7 +1581,7 @@ internal HttpMessage CreateGetDevBoxesByUserRequest(string userId, string filter return message; } - internal HttpMessage CreateGetDevBoxByUserRequest(string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateGetDevBoxRequest(string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1240,7 +1589,7 @@ internal HttpMessage CreateGetDevBoxByUserRequest(string userId, string devBoxNa var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1251,7 +1600,7 @@ internal HttpMessage CreateGetDevBoxByUserRequest(string userId, string devBoxNa return message; } - internal HttpMessage CreateCreateDevBoxRequest(string userId, string devBoxName, RequestContent content, RequestContext context) + internal HttpMessage CreateCreateDevBoxRequest(string projectName, string userId, string devBoxName, RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200201); var request = message.Request; @@ -1259,7 +1608,7 @@ internal HttpMessage CreateCreateDevBoxRequest(string userId, string devBoxName, var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1272,7 +1621,7 @@ internal HttpMessage CreateCreateDevBoxRequest(string userId, string devBoxName, return message; } - internal HttpMessage CreateDeleteDevBoxRequest(string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateDeleteDevBoxRequest(string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202204); var request = message.Request; @@ -1280,7 +1629,7 @@ internal HttpMessage CreateDeleteDevBoxRequest(string userId, string devBoxName, var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1291,7 +1640,7 @@ internal HttpMessage CreateDeleteDevBoxRequest(string userId, string devBoxName, return message; } - internal HttpMessage CreateStartDevBoxRequest(string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateStartDevBoxRequest(string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; @@ -1299,7 +1648,7 @@ internal HttpMessage CreateStartDevBoxRequest(string userId, string devBoxName, var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1311,7 +1660,7 @@ internal HttpMessage CreateStartDevBoxRequest(string userId, string devBoxName, return message; } - internal HttpMessage CreateStopDevBoxRequest(string userId, string devBoxName, bool? hibernate, RequestContext context) + internal HttpMessage CreateStopDevBoxRequest(string projectName, string userId, string devBoxName, bool? hibernate, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; @@ -1319,7 +1668,7 @@ internal HttpMessage CreateStopDevBoxRequest(string userId, string devBoxName, b var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1335,7 +1684,27 @@ internal HttpMessage CreateStopDevBoxRequest(string userId, string devBoxName, b return message; } - internal HttpMessage CreateGetRemoteConnectionRequest(string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateRestartDevBoxRequest(string projectName, string userId, string devBoxName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/devboxes/", false); + uri.AppendPath(devBoxName, true); + uri.AppendPath(":restart", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetRemoteConnectionRequest(string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1343,7 +1712,7 @@ internal HttpMessage CreateGetRemoteConnectionRequest(string userId, string devB var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); @@ -1355,7 +1724,7 @@ internal HttpMessage CreateGetRemoteConnectionRequest(string userId, string devB return message; } - internal HttpMessage CreateGetUpcomingActionsRequest(string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateGetActionsRequest(string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1363,19 +1732,19 @@ internal HttpMessage CreateGetUpcomingActionsRequest(string userId, string devBo var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); uri.AppendPath(devBoxName, true); - uri.AppendPath("/upcomingActions", false); + uri.AppendPath("/actions", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetUpcomingActionRequest(string userId, string devBoxName, string upcomingActionId, RequestContext context) + internal HttpMessage CreateGetActionRequest(string projectName, string userId, string devBoxName, string actionName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1383,20 +1752,20 @@ internal HttpMessage CreateGetUpcomingActionRequest(string userId, string devBox var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); uri.AppendPath(devBoxName, true); - uri.AppendPath("/upcomingActions/", false); - uri.AppendPath(upcomingActionId, true); + uri.AppendPath("/actions/", false); + uri.AppendPath(actionName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateSkipUpcomingActionRequest(string userId, string devBoxName, string upcomingActionId, RequestContext context) + internal HttpMessage CreateSkipActionRequest(string projectName, string userId, string devBoxName, string actionName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -1404,13 +1773,13 @@ internal HttpMessage CreateSkipUpcomingActionRequest(string userId, string devBo var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); uri.AppendPath(devBoxName, true); - uri.AppendPath("/upcomingActions/", false); - uri.AppendPath(upcomingActionId, true); + uri.AppendPath("/actions/", false); + uri.AppendPath(actionName, true); uri.AppendPath(":skip", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -1418,7 +1787,7 @@ internal HttpMessage CreateSkipUpcomingActionRequest(string userId, string devBo return message; } - internal HttpMessage CreateDelayUpcomingActionRequest(string userId, string devBoxName, string upcomingActionId, DateTimeOffset delayUntil, RequestContext context) + internal HttpMessage CreateDelayActionRequest(string projectName, string userId, string devBoxName, string actionName, DateTimeOffset until, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1426,22 +1795,82 @@ internal HttpMessage CreateDelayUpcomingActionRequest(string userId, string devB var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/projects/", false); - uri.AppendPath(_projectName, true); + uri.AppendPath(projectName, true); uri.AppendPath("/users/", false); uri.AppendPath(userId, true); uri.AppendPath("/devboxes/", false); uri.AppendPath(devBoxName, true); - uri.AppendPath("/upcomingActions/", false); - uri.AppendPath(upcomingActionId, true); + uri.AppendPath("/actions/", false); + uri.AppendPath(actionName, true); uri.AppendPath(":delay", false); - uri.AppendQuery("delayUntil", delayUntil, "O", true); + uri.AppendQuery("until", until, "O", true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDelayAllActionsRequest(string projectName, string userId, string devBoxName, DateTimeOffset until, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/projects/", false); + uri.AppendPath(projectName, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/devboxes/", false); + uri.AppendPath(devBoxName, true); + uri.AppendPath("/actions:delay", false); + uri.AppendQuery("until", until, "O", true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, int? maxCount, string filter, RequestContext context) + internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, string projectName, string filter, int? maxCount, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSchedulesNextPageRequest(string nextLink, string projectName, string poolName, string filter, int? maxCount, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAllDevBoxesNextPageRequest(string nextLink, string filter, int? maxCount, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAllDevBoxesByUserNextPageRequest(string nextLink, string userId, string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1454,7 +1883,7 @@ internal HttpMessage CreateGetPoolsNextPageRequest(string nextLink, int? maxCoun return message; } - internal HttpMessage CreateGetSchedulesByPoolNextPageRequest(string nextLink, string poolName, int? maxCount, string filter, RequestContext context) + internal HttpMessage CreateGetDevBoxesNextPageRequest(string nextLink, string projectName, string userId, string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1467,7 +1896,7 @@ internal HttpMessage CreateGetSchedulesByPoolNextPageRequest(string nextLink, st return message; } - internal HttpMessage CreateGetDevBoxesByUserNextPageRequest(string nextLink, string userId, string filter, int? maxCount, RequestContext context) + internal HttpMessage CreateGetActionsNextPageRequest(string nextLink, string projectName, string userId, string devBoxName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1480,7 +1909,7 @@ internal HttpMessage CreateGetDevBoxesByUserNextPageRequest(string nextLink, str return message; } - internal HttpMessage CreateGetUpcomingActionsNextPageRequest(string nextLink, string userId, string devBoxName, RequestContext context) + internal HttpMessage CreateDelayAllActionsNextPageRequest(string nextLink, string projectName, string userId, string devBoxName, DateTimeOffset until, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs index 0b6024a4b91b..dad220899561 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClient.cs @@ -78,7 +78,7 @@ public DevCenterClient(Uri endpoint, TokenCredential credential, DevCenterClient /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetProjectAsync(string projectName, RequestContext context) + public virtual async Task GetProjectAsync(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); @@ -113,7 +113,7 @@ public virtual async Task GetProjectAsync(string projectName, RequestC /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual Response GetProject(string projectName, RequestContext context) + public virtual Response GetProject(string projectName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); @@ -147,7 +147,7 @@ public virtual Response GetProject(string projectName, RequestContext context) /// 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(string filter = null, int? maxCount = null, RequestContext context = null) { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(filter, maxCount, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, filter, maxCount, context); @@ -170,115 +170,13 @@ public virtual AsyncPageable GetProjectsAsync(string filter, int? ma /// 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(string filter = null, int? maxCount = null, RequestContext context = null) { HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(filter, maxCount, context); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, filter, maxCount, context); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetProjects", "value", "nextLink", context); } - /// - /// [Protocol Method] Lists Dev Boxes that the caller has access to in the DevCenter. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetAllDevBoxes", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists Dev Boxes that the caller has access to in the DevCenter. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAllDevBoxesRequest(filter, maxCount, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAllDevBoxesNextPageRequest(nextLink, filter, maxCount, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetAllDevBoxes", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists Dev Boxes in the Dev Center for a particular user. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// 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) - { - 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); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetAllDevBoxesByUser", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists Dev Boxes in the Dev Center for a particular user. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The AAD object id of the user. If value is 'me', the identity is taken from the authentication context. The default value is "me". - /// 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) - { - 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); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "DevCenterClient.GetAllDevBoxesByUser", "value", "nextLink", context); - } - internal HttpMessage CreateGetProjectsRequest(string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); @@ -316,52 +214,6 @@ internal HttpMessage CreateGetProjectRequest(string projectName, RequestContext return message; } - internal HttpMessage CreateGetAllDevBoxesRequest(string filter, int? maxCount, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - 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) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/users/", false); - 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 CreateGetProjectsNextPageRequest(string nextLink, string filter, int? maxCount, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); @@ -375,32 +227,6 @@ internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, string fi return message; } - internal HttpMessage CreateGetAllDevBoxesNextPageRequest(string nextLink, string filter, int? maxCount, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetAllDevBoxesByUserNextPageRequest(string nextLink, string userId, string filter, int? maxCount, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs index 17f80b783b0e..60ee3f5e2669 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevCenterClientOptions.cs @@ -13,13 +13,13 @@ namespace Azure.Developer.DevCenter /// Client options for DevCenter library clients. public partial class DevCenterClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2022_11_11_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2023_04_01; /// The version of the service to use. public enum ServiceVersion { - /// Service version "2022-11-11-preview". - V2022_11_11_Preview = 1, + /// Service version "2023-04-01". + V2023_04_01 = 1, } internal string Version { get; } @@ -29,7 +29,7 @@ public DevCenterClientOptions(ServiceVersion version = LatestVersion) { Version = version switch { - ServiceVersion.V2022_11_11_Preview => "2022-11-11-preview", + ServiceVersion.V2023_04_01 => "2023-04-01", _ => throw new NotSupportedException() }; } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs index 44c3ed9d53e1..5341ddd4ecdd 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeveloperDevCenterClientBuilderExtensions.cs @@ -11,7 +11,7 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add , , to client builder. + /// Extension methods to add , , to client builder. public static partial class DeveloperDevCenterClientBuilderExtensions { /// Registers a instance. @@ -26,21 +26,19 @@ public static IAzureClientBuilder AddDe /// Registers a instance. /// The builder to register with. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. - public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, Uri endpoint, string projectName) + public static IAzureClientBuilder AddDevBoxesClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new DevBoxesClient(endpoint, projectName, cred, options)); + return builder.RegisterClientFactory((options, cred) => new DevBoxesClient(endpoint, cred, options)); } - /// Registers a instance. + /// Registers a instance. /// The builder to register with. /// The DevCenter-specific URI to operate on. - /// The DevCenter Project upon which to execute operations. - public static IAzureClientBuilder AddEnvironmentsClient(this TBuilder builder, Uri endpoint, string projectName) + public static IAzureClientBuilder AddDeploymentEnvironmentsClient(this TBuilder builder, Uri endpoint) where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options, cred) => new EnvironmentsClient(endpoint, projectName, cred, options)); + return builder.RegisterClientFactory((options, cred) => new DeploymentEnvironmentsClient(endpoint, cred, options)); } /// Registers a instance. @@ -59,13 +57,13 @@ public static IAzureClientBuilder AddDev { return builder.RegisterClientFactory(configuration); } - /// Registers a instance. + /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddEnvironmentsClient(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/Docs/DeploymentEnvironmentsClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml new file mode 100644 index 000000000000..73a59f9f03f1 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml @@ -0,0 +1,833 @@ + + + + + +This sample shows how to call GetEnvironmentAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentAsync("", "me", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetEnvironmentAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentAsync("", "me", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("user").ToString()); +Console.WriteLine(result.GetProperty("provisioningState").ToString()); +Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +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("parameters").ToString()); +]]> + + + +This sample shows how to call GetEnvironment and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironment("", "me", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetEnvironment with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironment("", "me", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("user").ToString()); +Console.WriteLine(result.GetProperty("provisioningState").ToString()); +Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +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("parameters").ToString()); +]]> + + + +This sample shows how to call GetCatalogAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetCatalogAsync("", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetCatalogAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetCatalogAsync("", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call GetCatalog and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetCatalog("", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetCatalog with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetCatalog("", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call GetEnvironmentDefinitionAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +]]> +This sample shows how to call GetEnvironmentDefinitionAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); +Console.WriteLine(result.GetProperty("parametersSchema").ToString()); +Console.WriteLine(result.GetProperty("templatePath").ToString()); +]]> + + + +This sample shows how to call GetEnvironmentDefinition and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironmentDefinition("", "", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +]]> +This sample shows how to call GetEnvironmentDefinition with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Response response = client.GetEnvironmentDefinition("", "", ""); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); +Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); +Console.WriteLine(result.GetProperty("parametersSchema").ToString()); +Console.WriteLine(result.GetProperty("templatePath").ToString()); +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); +} +]]> +This sample shows how to call GetAllEnvironmentsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); +} +]]> +This sample shows how to call GetAllEnvironments with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetAllEnvironments("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); +} +]]> + + + +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("", "me")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); +} +]]> +This sample shows how to call GetEnvironmentsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetEnvironmentsAsync("", "me", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); +} +]]> + + + +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("", "me")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); +} +]]> +This sample shows how to call GetEnvironments with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetEnvironments("", "me", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetCatalogsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetCatalogsAsync("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetCatalogs with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetCatalogs("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); +} +]]> +This sample shows how to call GetEnvironmentDefinitionsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); +} +]]> +This sample shows how to call GetEnvironmentDefinitions with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetEnvironmentDefinitions("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); +} +]]> + + + +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("", "")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); +} +]]> +This sample shows how to call GetEnvironmentDefinitionsByCatalogAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); +} +]]> + + + +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("", "")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); +} +]]> +This sample shows how to call GetEnvironmentDefinitionsByCatalog with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); +} +]]> +This sample shows how to call GetEnvironmentTypesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); +} +]]> + + + +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("")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); +} +]]> +This sample shows how to call GetEnvironmentTypes with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +foreach (BinaryData item in client.GetEnvironmentTypes("", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); +} +]]> + + + +This sample shows how to call CreateOrUpdateEnvironmentAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + environmentType = "", + catalogName = "", + environmentDefinitionName = "", +}); +Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "me", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call CreateOrUpdateEnvironmentAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + parameters = new object(), +}); +Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "me", "", content); +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("user").ToString()); +Console.WriteLine(result.GetProperty("provisioningState").ToString()); +Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +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("parameters").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateEnvironment and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + environmentType = "", + catalogName = "", + environmentDefinitionName = "", +}); +Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "me", "", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("environmentType").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call CreateOrUpdateEnvironment with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +RequestContent content = RequestContent.Create(new +{ + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + parameters = new object(), +}); +Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "me", "", content); +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("user").ToString()); +Console.WriteLine(result.GetProperty("provisioningState").ToString()); +Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); +Console.WriteLine(result.GetProperty("catalogName").ToString()); +Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); +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("parameters").ToString()); +]]> + + + +This sample shows how to call DeleteEnvironmentAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call DeleteEnvironmentAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +]]> + + + +This sample shows how to call DeleteEnvironment and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call DeleteEnvironment with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + +Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +]]> + + + \ No newline at end of file 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 75bccffdc683..387b1d0928e1 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml @@ -1,26 +1,28 @@ - + This sample shows how to call GetPoolAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetPoolAsync("", null); +Response response = await client.GetPoolAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("location").ToString()); +Console.WriteLine(result.GetProperty("healthStatus").ToString()); ]]> This sample shows how to call GetPoolAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetPoolAsync("", null); +Response response = await client.GetPoolAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -37,28 +39,33 @@ Console.WriteLine(result.GetProperty("imageReference").GetProperty("operatingSys Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString()); 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 GetPool and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetPool("", null); +Response response = client.GetPool("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("location").ToString()); +Console.WriteLine(result.GetProperty("healthStatus").ToString()); ]]> This sample shows how to call GetPool with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetPool("", null); +Response response = client.GetPool("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -75,28 +82,35 @@ Console.WriteLine(result.GetProperty("imageReference").GetProperty("operatingSys Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString()); 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 GetScheduleByPoolAsync and parse the result. +This sample shows how to call GetScheduleAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetScheduleByPoolAsync("", "", null); +Response response = await client.GetScheduleAsync("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +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()); ]]> -This sample shows how to call GetScheduleByPoolAsync with all parameters and parse the result. +This sample shows how to call GetScheduleAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetScheduleByPoolAsync("", "", null); +Response response = await client.GetScheduleAsync("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -106,26 +120,30 @@ Console.WriteLine(result.GetProperty("time").ToString()); Console.WriteLine(result.GetProperty("timeZone").ToString()); ]]> - + -This sample shows how to call GetScheduleByPool and parse the result. +This sample shows how to call GetSchedule and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetScheduleByPool("", "", null); +Response response = client.GetSchedule("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +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()); ]]> -This sample shows how to call GetScheduleByPool with all parameters and parse the result. +This sample shows how to call GetSchedule with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetScheduleByPool("", "", null); +Response response = client.GetSchedule("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -135,26 +153,26 @@ Console.WriteLine(result.GetProperty("time").ToString()); Console.WriteLine(result.GetProperty("timeZone").ToString()); ]]> - + -This sample shows how to call GetDevBoxByUserAsync and parse the result. +This sample shows how to call GetDevBoxAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetDevBoxByUserAsync("me", "", null); +Response response = await client.GetDevBoxAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("poolName").ToString()); ]]> -This sample shows how to call GetDevBoxByUserAsync with all parameters and parse the result. +This sample shows how to call GetDevBoxAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetDevBoxByUserAsync("me", "", null); +Response response = await client.GetDevBoxAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -165,8 +183,9 @@ Console.WriteLine(result.GetProperty("provisioningState").ToString()); Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); +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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -183,26 +202,26 @@ Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("localAdministrator").ToString()); ]]> - + -This sample shows how to call GetDevBoxByUser and parse the result. +This sample shows how to call GetDevBox and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetDevBoxByUser("me", "", null); +Response response = client.GetDevBox("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("poolName").ToString()); ]]> -This sample shows how to call GetDevBoxByUser with all parameters and parse the result. +This sample shows how to call GetDevBox with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetDevBoxByUser("me", "", null); +Response response = client.GetDevBox("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -213,8 +232,9 @@ Console.WriteLine(result.GetProperty("provisioningState").ToString()); Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); +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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -231,15 +251,15 @@ Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("localAdministrator").ToString()); ]]> - + This sample shows how to call GetRemoteConnectionAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetRemoteConnectionAsync("me", "", null); +Response response = await client.GetRemoteConnectionAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -248,24 +268,24 @@ This sample shows how to call GetRemoteConnectionAsync with all parameters and p "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetRemoteConnectionAsync("me", "", null); +Response response = await client.GetRemoteConnectionAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("webUrl").ToString()); Console.WriteLine(result.GetProperty("rdpConnectionUrl").ToString()); ]]> - + This sample shows how to call GetRemoteConnection and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetRemoteConnection("me", "", null); +Response response = client.GetRemoteConnection("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -274,198 +294,204 @@ This sample shows how to call GetRemoteConnection with all parameters and parse "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetRemoteConnection("me", "", null); +Response response = client.GetRemoteConnection("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("webUrl").ToString()); Console.WriteLine(result.GetProperty("rdpConnectionUrl").ToString()); ]]> - + -This sample shows how to call GetUpcomingActionAsync and parse the result. +This sample shows how to call GetActionAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetUpcomingActionAsync("me", "", "", null); +Response response = await client.GetActionAsync("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("actionType").ToString()); +Console.WriteLine(result.GetProperty("sourceId").ToString()); ]]> -This sample shows how to call GetUpcomingActionAsync with all parameters and parse the result. +This sample shows how to call GetActionAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.GetUpcomingActionAsync("me", "", "", null); +Response response = await client.GetActionAsync("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); -Console.WriteLine(result.GetProperty("reason").ToString()); -Console.WriteLine(result.GetProperty("scheduledTime").ToString()); -Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); +Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); ]]> - + -This sample shows how to call GetUpcomingAction and parse the result. +This sample shows how to call GetAction and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetUpcomingAction("me", "", "", null); +Response response = client.GetAction("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("actionType").ToString()); +Console.WriteLine(result.GetProperty("sourceId").ToString()); ]]> -This sample shows how to call GetUpcomingAction with all parameters and parse the result. +This sample shows how to call GetAction with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.GetUpcomingAction("me", "", "", null); +Response response = client.GetAction("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); -Console.WriteLine(result.GetProperty("reason").ToString()); -Console.WriteLine(result.GetProperty("scheduledTime").ToString()); -Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); +Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); ]]> - + -This sample shows how to call SkipUpcomingActionAsync. +This sample shows how to call SkipActionAsync. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.SkipUpcomingActionAsync("me", "", ""); +Response response = await client.SkipActionAsync("", "me", "", ""); Console.WriteLine(response.Status); ]]> -This sample shows how to call SkipUpcomingActionAsync with all parameters. +This sample shows how to call SkipActionAsync with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.SkipUpcomingActionAsync("me", "", ""); +Response response = await client.SkipActionAsync("", "me", "", ""); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call SkipUpcomingAction. +This sample shows how to call SkipAction. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.SkipUpcomingAction("me", "", ""); +Response response = client.SkipAction("", "me", "", ""); Console.WriteLine(response.Status); ]]> -This sample shows how to call SkipUpcomingAction with all parameters. +This sample shows how to call SkipAction with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.SkipUpcomingAction("me", "", ""); +Response response = client.SkipAction("", "me", "", ""); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call DelayUpcomingActionAsync and parse the result. +This sample shows how to call DelayActionAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.DelayUpcomingActionAsync("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); +Response response = await client.DelayActionAsync("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("actionType").ToString()); +Console.WriteLine(result.GetProperty("sourceId").ToString()); ]]> -This sample shows how to call DelayUpcomingActionAsync with all parameters and parse the result. +This sample shows how to call DelayActionAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = await client.DelayUpcomingActionAsync("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); +Response response = await client.DelayActionAsync("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); -Console.WriteLine(result.GetProperty("reason").ToString()); -Console.WriteLine(result.GetProperty("scheduledTime").ToString()); -Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); +Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); ]]> - + -This sample shows how to call DelayUpcomingAction and parse the result. +This sample shows how to call DelayAction and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.DelayUpcomingAction("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); +Response response = client.DelayAction("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("actionType").ToString()); +Console.WriteLine(result.GetProperty("sourceId").ToString()); ]]> -This sample shows how to call DelayUpcomingAction with all parameters and parse the result. +This sample shows how to call DelayAction with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Response response = client.DelayUpcomingAction("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); +Response response = client.DelayAction("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); -Console.WriteLine(result.GetProperty("reason").ToString()); -Console.WriteLine(result.GetProperty("scheduledTime").ToString()); -Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); +Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); +Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); ]]> - + This sample shows how to call GetPoolsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetPoolsAsync(null, null, null)) +await foreach (BinaryData item in client.GetPoolsAsync("")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } ]]> This sample shows how to call GetPoolsAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetPoolsAsync(1234, "", null)) +await foreach (BinaryData item in client.GetPoolsAsync("", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -482,30 +508,35 @@ await foreach (BinaryData item in client.GetPoolsAsync(1234, "", null)) Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("gracePeriodMinutes").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } ]]> - + This sample shows how to call GetPools and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetPools(null, null, null)) +foreach (BinaryData item in client.GetPools("")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } ]]> This sample shows how to call GetPools with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetPools(1234, "", null)) +foreach (BinaryData item in client.GetPools("", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -522,30 +553,37 @@ foreach (BinaryData item in client.GetPools(1234, "", null)) Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("gracePeriodMinutes").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } ]]> - + -This sample shows how to call GetSchedulesByPoolAsync and parse the result. +This sample shows how to call GetSchedulesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetSchedulesByPoolAsync("", null, null, null)) +await foreach (BinaryData item in client.GetSchedulesAsync("", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("frequency").ToString()); + Console.WriteLine(result[0].GetProperty("time").ToString()); + Console.WriteLine(result[0].GetProperty("timeZone").ToString()); } ]]> -This sample shows how to call GetSchedulesByPoolAsync with all parameters and parse the result. +This sample shows how to call GetSchedulesAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetSchedulesByPoolAsync("", 1234, "", null)) +await foreach (BinaryData item in client.GetSchedulesAsync("", "", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -556,27 +594,31 @@ await foreach (BinaryData item in client.GetSchedulesByPoolAsync("", 1 } ]]> - + -This sample shows how to call GetSchedulesByPool and parse the result. +This sample shows how to call GetSchedules and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetSchedulesByPool("", null, null, null)) +foreach (BinaryData item in client.GetSchedules("", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("frequency").ToString()); + Console.WriteLine(result[0].GetProperty("time").ToString()); + Console.WriteLine(result[0].GetProperty("timeZone").ToString()); } ]]> -This sample shows how to call GetSchedulesByPool with all parameters and parse the result. +This sample shows how to call GetSchedules with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetSchedulesByPool("", 1234, "", null)) +foreach (BinaryData item in client.GetSchedules("", "", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -587,27 +629,180 @@ foreach (BinaryData item in client.GetSchedulesByPool("", 1234, " - + + +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()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); +} +]]> +This sample shows how to call GetAllDevBoxesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.GetAllDevBoxesAsync(filter: "", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); +} +]]> + + + +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()) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); +} +]]> +This sample shows how to call GetAllDevBoxes with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (BinaryData item in client.GetAllDevBoxes(filter: "", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); +} +]]> + + + +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("me")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); +} +]]> +This sample shows how to call GetAllDevBoxesByUserAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", filter: "", maxCount: 1234)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); +} +]]> + + -This sample shows how to call GetDevBoxesByUserAsync and parse the result. +This sample shows how to call GetAllDevBoxesByUser and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", null, null, null)) +foreach (BinaryData item in client.GetAllDevBoxesByUser("me")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("poolName").ToString()); } ]]> -This sample shows how to call GetDevBoxesByUserAsync with all parameters and parse the result. +This sample shows how to call GetAllDevBoxesByUser with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", "", 1234, null)) +foreach (BinaryData item in client.GetAllDevBoxesByUser("me", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -618,8 +813,9 @@ await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", "" Console.WriteLine(result[0].GetProperty("actionState").ToString()); Console.WriteLine(result[0].GetProperty("powerState").ToString()); Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); Console.WriteLine(result[0].GetProperty("location").ToString()); Console.WriteLine(result[0].GetProperty("osType").ToString()); Console.WriteLine(result[0].GetProperty("user").ToString()); @@ -637,27 +833,27 @@ await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", "" } ]]> - + -This sample shows how to call GetDevBoxesByUser and parse the result. +This sample shows how to call GetDevBoxesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetDevBoxesByUser("me", null, null, null)) +await foreach (BinaryData item in client.GetDevBoxesAsync("", "me")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("poolName").ToString()); } ]]> -This sample shows how to call GetDevBoxesByUser with all parameters and parse the result. +This sample shows how to call GetDevBoxesAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetDevBoxesByUser("me", "", 1234, null)) +await foreach (BinaryData item in client.GetDevBoxesAsync("", "me", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -668,8 +864,9 @@ foreach (BinaryData item in client.GetDevBoxesByUser("me", "", 1234, nul Console.WriteLine(result[0].GetProperty("actionState").ToString()); Console.WriteLine(result[0].GetProperty("powerState").ToString()); Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); Console.WriteLine(result[0].GetProperty("location").ToString()); Console.WriteLine(result[0].GetProperty("osType").ToString()); Console.WriteLine(result[0].GetProperty("user").ToString()); @@ -687,83 +884,210 @@ foreach (BinaryData item in client.GetDevBoxesByUser("me", "", 1234, nul } ]]> - + -This sample shows how to call GetUpcomingActionsAsync and parse the result. +This sample shows how to call GetDevBoxes and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetUpcomingActionsAsync("me", "", null)) +foreach (BinaryData item in client.GetDevBoxes("", "me")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); } ]]> -This sample shows how to call GetUpcomingActionsAsync with all parameters and parse the result. +This sample shows how to call GetDevBoxes with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -await foreach (BinaryData item in client.GetUpcomingActionsAsync("me", "", null)) +foreach (BinaryData item in client.GetDevBoxes("", "me", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); +} +]]> + + + +This sample shows how to call GetActionsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.GetActionsAsync("", "me", "")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("actionType").ToString()); - Console.WriteLine(result[0].GetProperty("reason").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTime").ToString()); - Console.WriteLine(result[0].GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result[0].GetProperty("sourceId").ToString()); } +]]> +This sample shows how to call GetActionsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.GetActionsAsync("", "me", "")) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("next").GetProperty("scheduledTime").ToString()); +} ]]> - + -This sample shows how to call GetUpcomingActions and parse the result. +This sample shows how to call GetActions and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetUpcomingActions("me", "", null)) +foreach (BinaryData item in client.GetActions("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("sourceId").ToString()); } ]]> -This sample shows how to call GetUpcomingActions with all parameters and parse the result. +This sample shows how to call GetActions with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -foreach (BinaryData item in client.GetUpcomingActions("me", "", null)) +foreach (BinaryData item in client.GetActions("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("actionType").ToString()); - Console.WriteLine(result[0].GetProperty("reason").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTime").ToString()); - Console.WriteLine(result[0].GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result[0].GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("next").GetProperty("scheduledTime").ToString()); +} +]]> + + + +This sample shows how to call DelayAllActionsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.DelayAllActionsAsync("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); +} +]]> +This sample shows how to call DelayAllActionsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +await foreach (BinaryData item in client.DelayAllActionsAsync("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("next").GetProperty("scheduledTime").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); +} +]]> + + + +This sample shows how to call DelayAllActions and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (BinaryData item in client.DelayAllActions("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); +} +]]> +This sample shows how to call DelayAllActions with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +foreach (BinaryData item in client.DelayAllActions("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("next").GetProperty("scheduledTime").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); } ]]> - + This sample shows how to call CreateDevBoxAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", }); -Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "me", "", content); +Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -773,14 +1097,14 @@ This sample shows how to call CreateDevBoxAsync with all parameters and request "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", localAdministrator = "Enabled", }); -Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "me", "", content); +Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -792,8 +1116,9 @@ Console.WriteLine(result.GetProperty("provisioningState").ToString()); Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); +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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -810,19 +1135,19 @@ Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("localAdministrator").ToString()); ]]> - + This sample shows how to call CreateDevBox and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", }); -Operation operation = client.CreateDevBox(WaitUntil.Completed, "me", "", content); +Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -832,14 +1157,14 @@ This sample shows how to call CreateDevBox with all parameters and request conte "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", localAdministrator = "Enabled", }); -Operation operation = client.CreateDevBox(WaitUntil.Completed, "me", "", content); +Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -851,8 +1176,9 @@ Console.WriteLine(result.GetProperty("provisioningState").ToString()); Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); +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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -869,118 +1195,292 @@ Console.WriteLine(result.GetProperty("createdTime").ToString()); Console.WriteLine(result.GetProperty("localAdministrator").ToString()); ]]> - + -This sample shows how to call DeleteDevBoxAsync. +This sample shows how to call DeleteDevBoxAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; -Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "me", ""); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call DeleteDevBoxAsync with all parameters. +This sample shows how to call DeleteDevBoxAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; -Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "me", ""); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> - + -This sample shows how to call DeleteDevBox. +This sample shows how to call DeleteDevBox and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.DeleteDevBox(WaitUntil.Completed, "me", ""); +Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call DeleteDevBox with all parameters. +This sample shows how to call DeleteDevBox with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.DeleteDevBox(WaitUntil.Completed, "me", ""); +Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> - + -This sample shows how to call StartDevBoxAsync. +This sample shows how to call StartDevBoxAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "me", ""); +Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call StartDevBoxAsync with all parameters. +This sample shows how to call StartDevBoxAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "me", ""); +Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> - + -This sample shows how to call StartDevBox. +This sample shows how to call StartDevBox and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = client.StartDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; -Operation operation = client.StartDevBox(WaitUntil.Completed, "me", ""); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call StartDevBox with all parameters. +This sample shows how to call StartDevBox with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.StartDevBox(WaitUntil.Completed, "me", ""); +Operation operation = client.StartDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> - + -This sample shows how to call StopDevBoxAsync. +This sample shows how to call StopDevBoxAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; -Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "me", ""); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call StopDevBoxAsync with all parameters. +This sample shows how to call StopDevBoxAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "", "me", "", hibernate: true); +BinaryData responseData = operation.Value; -Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "me", "", hibernate: true); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> - + -This sample shows how to call StopDevBox. +This sample shows how to call StopDevBox and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = client.StopDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; -Operation operation = client.StopDevBox(WaitUntil.Completed, "me", ""); +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); ]]> -This sample shows how to call StopDevBox with all parameters. +This sample shows how to call StopDevBox with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); -DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.StopDevBox(WaitUntil.Completed, "me", "", hibernate: true); +Operation operation = client.StopDevBox(WaitUntil.Completed, "", "me", "", hibernate: true); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +]]> + + + +This sample shows how to call RestartDevBoxAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.RestartDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call RestartDevBoxAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = await client.RestartDevBoxAsync(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +]]> + + + +This sample shows how to call RestartDevBox and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = client.RestartDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("status").ToString()); +]]> +This sample shows how to call RestartDevBox with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +DevBoxesClient client = new DevBoxesClient(endpoint, credential); + +Operation operation = client.RestartDevBox(WaitUntil.Completed, "", "me", ""); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("resourceId").ToString()); +Console.WriteLine(result.GetProperty("startTime").ToString()); +Console.WriteLine(result.GetProperty("endTime").ToString()); +Console.WriteLine(result.GetProperty("percentComplete").ToString()); +Console.WriteLine(result.GetProperty("properties").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); ]]> 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 0fc56e0a4cd8..5e4cb6bb4a46 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevCenterClient.xml @@ -9,10 +9,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -Response response = await client.GetProjectAsync("", null); +Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> This sample shows how to call GetProjectAsync with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -Response response = await client.GetProjectAsync("", null); +Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); ]]> @@ -35,10 +36,10 @@ Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -Response response = client.GetProject("", null); +Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); ]]> This sample shows how to call GetProject with all parameters and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); -Response response = client.GetProject("", null); +Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); ]]> @@ -61,10 +63,10 @@ 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()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } ]]> This sample shows how to call GetProjectsAsync with all parameters and parse the result. @@ -73,11 +75,12 @@ 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(filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("maxDevBoxesPerUser").ToString()); } ]]> @@ -89,10 +92,10 @@ 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()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } ]]> This sample shows how to call GetProjects with all parameters and parse the result. @@ -101,211 +104,12 @@ 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(filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("description").ToString()); -} -]]> - - - -This sample shows how to call GetAllDevBoxesAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -await foreach (BinaryData item in client.GetAllDevBoxesAsync(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); -} -]]> -This sample shows how to call GetAllDevBoxesAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -await foreach (BinaryData item in client.GetAllDevBoxesAsync("", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); -} -]]> - - - -This sample shows how to call GetAllDevBoxes and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -foreach (BinaryData item in client.GetAllDevBoxes(null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); -} -]]> -This sample shows how to call GetAllDevBoxes with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -foreach (BinaryData item in client.GetAllDevBoxes("", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); -} -]]> - - - -This sample shows how to call GetAllDevBoxesByUserAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); -} -]]> -This sample shows how to call GetAllDevBoxesByUserAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", "", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); -} -]]> - - - -This sample shows how to call GetAllDevBoxesByUser and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -foreach (BinaryData item in client.GetAllDevBoxesByUser("me", null, null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); -} -]]> -This sample shows how to call GetAllDevBoxesByUser with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -DevCenterClient client = new DevCenterClient(endpoint, credential); - -foreach (BinaryData item in client.GetAllDevBoxesByUser("me", "", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("maxDevBoxesPerUser").ToString()); } ]]> diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/EnvironmentsClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/EnvironmentsClient.xml deleted file mode 100644 index 09947ea218d8..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/EnvironmentsClient.xml +++ /dev/null @@ -1,1047 +0,0 @@ - - - - - -This sample shows how to call GetEnvironmentByUserAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetEnvironmentByUserAsync("me", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetEnvironmentByUserAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetEnvironmentByUserAsync("me", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.GetProperty("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call GetEnvironmentByUser and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetEnvironmentByUser("me", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetEnvironmentByUser with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetEnvironmentByUser("me", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.GetProperty("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call UpdateEnvironmentAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new object()); -Response response = await client.UpdateEnvironmentAsync("me", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call UpdateEnvironmentAsync with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, -}); -Response response = await client.UpdateEnvironmentAsync("me", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.GetProperty("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call UpdateEnvironment and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new object()); -Response response = client.UpdateEnvironment("me", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call UpdateEnvironment with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, -}); -Response response = client.UpdateEnvironment("me", "", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.GetProperty("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call GetCatalogItemAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetCatalogItemAsync("", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetCatalogItemAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetCatalogItemAsync("", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -]]> - - - -This sample shows how to call GetCatalogItem and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetCatalogItem("", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetCatalogItem with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetCatalogItem("", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -]]> - - - -This sample shows how to call GetCatalogItemVersionAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetCatalogItemVersionAsync("", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetCatalogItemVersionAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = await client.GetCatalogItemVersionAsync("", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("catalogItemId").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("version").ToString()); -Console.WriteLine(result.GetProperty("summary").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("templatePath").ToString()); -Console.WriteLine(result.GetProperty("parametersSchema").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("typeName").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("runner").ToString()); -Console.WriteLine(result.GetProperty("runner").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("eligibleForLatestVersion").ToString()); -]]> - - - -This sample shows how to call GetCatalogItemVersion and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetCatalogItemVersion("", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call GetCatalogItemVersion with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Response response = client.GetCatalogItemVersion("", "", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("catalogItemId").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("version").ToString()); -Console.WriteLine(result.GetProperty("summary").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("templatePath").ToString()); -Console.WriteLine(result.GetProperty("parametersSchema").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); -Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("typeName").ToString()); -Console.WriteLine(result.GetProperty("actions")[0].GetProperty("runner").ToString()); -Console.WriteLine(result.GetProperty("runner").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("eligibleForLatestVersion").ToString()); -]]> - - - -This sample shows how to call GetEnvironmentsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentsAsync(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironmentsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentsAsync(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); -} -]]> - - - -This sample shows how to call GetEnvironments and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironments(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironments with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironments(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); -} -]]> - - - -This sample shows how to call GetEnvironmentsByUserAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentsByUserAsync("me", null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironmentsByUserAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentsByUserAsync("me", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); -} -]]> - - - -This sample shows how to call GetEnvironmentsByUser and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironmentsByUser("me", null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironmentsByUser with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironmentsByUser("me", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); -} -]]> - - - -This sample shows how to call GetCatalogItemsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetCatalogItemsAsync(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetCatalogItemsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetCatalogItemsAsync(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); -} -]]> - - - -This sample shows how to call GetCatalogItems and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetCatalogItems(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetCatalogItems with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetCatalogItems(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); -} -]]> - - - -This sample shows how to call GetCatalogItemVersionsAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetCatalogItemVersionsAsync("", null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetCatalogItemVersionsAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetCatalogItemVersionsAsync("", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("catalogItemId").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("summary").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("templatePath").ToString()); - Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - Console.WriteLine(result[0].GetProperty("eligibleForLatestVersion").ToString()); -} -]]> - - - -This sample shows how to call GetCatalogItemVersions and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetCatalogItemVersions("", null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetCatalogItemVersions with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetCatalogItemVersions("", 1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("catalogItemId").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("summary").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("templatePath").ToString()); - Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - Console.WriteLine(result[0].GetProperty("eligibleForLatestVersion").ToString()); -} -]]> - - - -This sample shows how to call GetEnvironmentTypesAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentTypesAsync(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironmentTypesAsync with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -await foreach (BinaryData item in client.GetEnvironmentTypesAsync(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); -} -]]> - - - -This sample shows how to call GetEnvironmentTypes and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironmentTypes(null, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); -} -]]> -This sample shows how to call GetEnvironmentTypes with all parameters and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -foreach (BinaryData item in client.GetEnvironmentTypes(1234, null)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); -} -]]> - - - -This sample shows how to call CreateOrUpdateEnvironmentAsync and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - environmentType = "", -}); -Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call CreateOrUpdateEnvironmentAsync with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - environmentType = "", - user = "", - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, -}); -Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "", content); -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("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call CreateOrUpdateEnvironment and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - environmentType = "", -}); -Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "me", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("environmentType").ToString()); -Console.WriteLine(result.ToString()); -]]> -This sample shows how to call CreateOrUpdateEnvironment with all parameters and request content and parse the result. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - environmentType = "", - user = "", - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, -}); -Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "me", "", content); -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("user").ToString()); -Console.WriteLine(result.GetProperty("provisioningState").ToString()); -Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("catalogName").ToString()); -Console.WriteLine(result.GetProperty("catalogItemName").ToString()); -Console.WriteLine(result.GetProperty("parameters").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); -Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); -]]> - - - -This sample shows how to call DeleteEnvironmentAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "me", ""); -]]> -This sample shows how to call DeleteEnvironmentAsync with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "me", ""); -]]> - - - -This sample shows how to call DeleteEnvironment. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "me", ""); -]]> -This sample shows how to call DeleteEnvironment with all parameters. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "me", ""); -]]> - - - -This sample shows how to call DeployEnvironmentActionAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", -}); -Operation operation = await client.DeployEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); -]]> -This sample shows how to call DeployEnvironmentActionAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", - parameters = new object(), -}); -Operation operation = await client.DeployEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); -]]> - - - -This sample shows how to call DeployEnvironmentAction. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", -}); -Operation operation = client.DeployEnvironmentAction(WaitUntil.Completed, "me", "", content); -]]> -This sample shows how to call DeployEnvironmentAction with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", - parameters = new object(), -}); -Operation operation = client.DeployEnvironmentAction(WaitUntil.Completed, "me", "", content); -]]> - - - -This sample shows how to call CustomEnvironmentActionAsync. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", -}); -Operation operation = await client.CustomEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); -]]> -This sample shows how to call CustomEnvironmentActionAsync with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", - parameters = new object(), -}); -Operation operation = await client.CustomEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); -]]> - - - -This sample shows how to call CustomEnvironmentAction. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", -}); -Operation operation = client.CustomEnvironmentAction(WaitUntil.Completed, "me", "", content); -]]> -This sample shows how to call CustomEnvironmentAction with all parameters and request content. -"); -TokenCredential credential = new DefaultAzureCredential(); -EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - -RequestContent content = RequestContent.Create(new -{ - actionId = "", - parameters = new object(), -}); -Operation operation = client.CustomEnvironmentAction(WaitUntil.Completed, "me", "", content); -]]> - - - \ No newline at end of file diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/autorest.md b/sdk/devcenter/Azure.Developer.DevCenter/src/autorest.md index 038bbea6d568..d6f30a611b14 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/autorest.md +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/autorest.md @@ -7,18 +7,83 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/af3f7994582c0cbd61a48b636907ad2ac95d332c/specification/devcenter/data-plane/Microsoft.DevCenter/preview/2022-11-11-preview/devcenter.json - - https://github.com/Azure/azure-rest-api-specs/blob/af3f7994582c0cbd61a48b636907ad2ac95d332c/specification/devcenter/data-plane/Microsoft.DevCenter/preview/2022-11-11-preview/devbox.json - - https://github.com/Azure/azure-rest-api-specs/blob/af3f7994582c0cbd61a48b636907ad2ac95d332c/specification/devcenter/data-plane/Microsoft.DevCenter/preview/2022-11-11-preview/environments.json + - https://github.com/Azure/azure-rest-api-specs/blob/552eaca3fb1940d5ec303746017d1764861031e6/specification/devcenter/data-plane/Microsoft.DevCenter/stable/2023-04-01/devcenter.json + - https://github.com/Azure/azure-rest-api-specs/blob/552eaca3fb1940d5ec303746017d1764861031e6/specification/devcenter/data-plane/Microsoft.DevCenter/stable/2023-04-01/devbox.json + - https://github.com/Azure/azure-rest-api-specs/blob/552eaca3fb1940d5ec303746017d1764861031e6/specification/devcenter/data-plane/Microsoft.DevCenter/stable/2023-04-01/environments.json namespace: Azure.Developer.DevCenter security: AADToken security-scopes: https://devcenter.azure.com/.default +data-plane: true +keep-non-overloadable-protocol-signature: true directive: + + # Move project name to method level parameters + - from: swagger-document + where: $.parameters["ProjectNameParameter"] + transform: >- + $["x-ms-parameter-location"] = "method" + # Ensure we use Uri rather than string in .NET - from: swagger-document where: "$.parameters.EndpointParameter" transform: >- $["format"] = "url"; + + # @autorest/csharp hasn't yet shipped a version which understands operation-location. Until then, pull the options. + # TODO: remove these directives once fix makes it to a version of @autorest/csharp + - from: swagger-document + where-operation: DevBoxes_DeleteDevBox + transform: >- + delete $["x-ms-long-running-operation-options"]; + + - from: swagger-document + where-operation: DevBoxes_RestartDevBox + transform: >- + delete $["x-ms-long-running-operation-options"]; + + - from: swagger-document + where-operation: DevBoxes_StartDevBox + transform: >- + delete $["x-ms-long-running-operation-options"]; + + - from: swagger-document + where-operation: DevBoxes_StopDevBox + transform: >- + delete $["x-ms-long-running-operation-options"]; + + # Override operation names to match SDK naming preferences + - from: swagger-document + where: $..[?(@.operationId !== undefined)] + transform: >- + const mappingTable = { + "DevBoxes_DelayActions": "DevBoxes_DelayAllActions", + "DevBoxes_GetDevBoxByUser": "DevBoxes_GetDevBox", + "DevBoxes_ListDevBoxesByUser": "DevBoxes_ListDevBoxes", + "DevBoxes_GetScheduleByPool": "DevBoxes_GetSchedule", + "DevCenter_ListAllDevBoxes": "DevBoxes_ListAllDevBoxes", + "DevCenter_ListAllDevBoxesByUser": "DevBoxes_ListAllDevBoxesByUser", + "Environments_CreateOrReplaceEnvironment": "DeploymentEnvironments_CreateOrUpdateEnvironment", + "Environments_DeleteEnvironment": "DeploymentEnvironments_DeleteEnvironment", + "Environments_GetCatalog": "DeploymentEnvironments_GetCatalog", + "Environments_GetEnvironmentByUser": "DeploymentEnvironments_GetEnvironment", + "Environments_GetEnvironmentDefinition": "DeploymentEnvironments_GetEnvironmentDefinition", + "Environments_ListCatalogsByProject": "DeploymentEnvironments_ListCatalogs", + "Environments_ListEnvironmentDefinitionsByCatalog": "DeploymentEnvironments_ListEnvironmentDefinitionsByCatalog", + "Environments_ListEnvironmentDefinitionsByProject": "DeploymentEnvironments_ListEnvironmentDefinitions", + "Environments_ListEnvironments": "DeploymentEnvironments_ListAllEnvironments", + "Environments_ListEnvironmentsByUser": "DeploymentEnvironments_ListEnvironments", + "Environments_ListEnvironmentTypes": "DeploymentEnvironments_ListEnvironmentTypes", + "DevBoxes_ListSchedulesByPool": "DevBoxes_ListSchedules", + }; + + $.operationId = (mappingTable[$.operationId] ?? $.operationId); + + - from: swagger-document + where: $..[?(@.operationId == "DevBoxes_ListSchedules" || @.operationId == "DevBoxes_ListPools")] + transform: >- + topParam = $.parameters[1]; + $.parameters[1] = $.parameters[2]; + $.parameters[2] = topParam; ``` diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Azure.Developer.DevCenter.Tests.csproj b/sdk/devcenter/Azure.Developer.DevCenter/tests/Azure.Developer.DevCenter.Tests.csproj index 5b79eb22625d..4059cb797477 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Azure.Developer.DevCenter.Tests.csproj +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Azure.Developer.DevCenter.Tests.csproj @@ -20,9 +20,4 @@ - - - - - diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs new file mode 100644 index 000000000000..c2ae6e214f55 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxClientTests.cs @@ -0,0 +1,423 @@ +// 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 DevCenterClientOptions()))); + + 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); + + BinaryData devBoxData = await devBoxStopOperation.WaitForCompletionAsync(); + JsonElement devBox = JsonDocument.Parse(devBoxData.ToStream()).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); + + devBoxData = await devBoxStartOperation.WaitForCompletionAsync(); + devBox = JsonDocument.Parse(devBoxData.ToStream()).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); + + 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); + + 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)) + { + 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()) + { + 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)) + { + 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); + + 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)) + { + 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)) + { + 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"); + + 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.GetActionsAsync(TestEnvironment.ProjectName, TestEnvironment.MeUserId, DevBoxName)) + { + 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.GetActionAsync( + TestEnvironment.ProjectName, + TestEnvironment.MeUserId, + DevBoxName, + "schedule-default"); + + 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); + + 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)) + { + 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/DevBoxCreateTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxCreateTests.cs deleted file mode 100644 index d13c4338b2cb..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevBoxCreateTests.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.IO; -using System.Net.Http; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Core.TestFramework; -using NUnit.Framework; - -namespace Azure.Developer.DevCenter.Tests -{ - public class DevBoxCreateTests: RecordedTestBase - { - public DevBoxCreateTests(bool isAsync) : base(isAsync) - { - } - - private DevBoxesClient GetDevBoxesClient() => - InstrumentClient(new DevBoxesClient( - TestEnvironment.Endpoint, - TestEnvironment.ProjectName, - TestEnvironment.Credential, - InstrumentClientOptions(new DevCenterClientOptions()))); - - [RecordedTest] - [PlaybackOnly("Dev box creation time takes several hours which is blocking for live integration tests")] - public async Task DevBoxCreationSucceeds() - { - DevBoxesClient devBoxesClient = GetDevBoxesClient(); - var content = new - { - poolName = TestEnvironment.PoolName, - }; - - Operation devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(WaitUntil.Completed, userId: TestEnvironment.UserId, "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")}."); - - 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); - - // Start the dev box - Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync(userId: TestEnvironment.UserId, "MyDevBox", new RequestContext()); - JsonElement remoteConnectionData = JsonDocument.Parse(remoteConnectionResponse.ContentStream).RootElement; - Console.WriteLine($"Connect using web URL {remoteConnectionData.GetProperty("webUrl")}."); - - // Delete the dev box - Operation devBoxDeleteOperation = await devBoxesClient.DeleteDevBoxAsync(WaitUntil.Completed, userId: TestEnvironment.UserId, "MyDevBox"); - await devBoxDeleteOperation.WaitForCompletionResponseAsync(); - Console.WriteLine($"Completed dev box deletion."); - } - - #region Helpers - - private static BinaryData GetContentFromResponse(Response r) - { - // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses - // from the playback system. - - MemoryStream ms = new MemoryStream(); - r.ContentStream.CopyTo(ms); - return new BinaryData(ms.ToArray()); - } - #endregion - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs index dec4db6e6831..7ad8413a39de 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTestEnvironment.cs @@ -1,58 +1,19 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Azure.Core; using System; using Azure.Core.TestFramework; -using Azure.Identity; -using Microsoft.Identity.Client; -using System.Collections.Generic; -using System.Security; -using System.Threading; -using System.Threading.Tasks; namespace Azure.Developer.DevCenter.Tests { public class DevCenterClientTestEnvironment : TestEnvironment { - private TokenCredential _credential; - private Uri _authority => new(AuthorityHostUrl + TenantId); - private string _scope => GetRecordedVariable("DEFAULT_DEVCENTER_SCOPE"); - private string _testUserSecret => GetRecordedVariable("DEFAULT_TEST_USER_SECRET", options => options.IsSecret()); - private string _testUserName => GetRecordedVariable("DEFAULT_TEST_USER_NAME"); 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 override TokenCredential Credential - { - get - { - if (_credential != null) - { - return _credential; - } - - if (Mode == RecordedTestMode.Playback) - { - _credential = new MockCredential(); - } - else - { - _credential = new DevCenterTestUserCredential(ClientId, - ClientSecret, - UserId, - _testUserSecret, - _testUserName, - _scope, - new Uri(AuthorityHostUrl + TenantId)); - } - - return _credential; - } - } + public string MeUserId => "me"; } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs new file mode 100644 index 000000000000..3e4378f15820 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterClientTests.cs @@ -0,0 +1,70 @@ +// 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.TestFramework; +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; + + internal DevCenterClient GetDevCenterClient() => + InstrumentClient(new DevCenterClient( + TestEnvironment.Endpoint, + TestEnvironment.Credential, + InstrumentClientOptions(new DevCenterClientOptions()))); + + public DevCenterClientTests(bool isAsync) : base(isAsync) + { + } + + [SetUp] + public void SetUp() + { + _devCenterClient = GetDevCenterClient(); + } + + [RecordedTest] + public async Task GetProjectsSucceeds() + { + var numberOfReturnedProjects = 0; + await foreach (BinaryData projectData in _devCenterClient.GetProjectsAsync()) + { + numberOfReturnedProjects++; + JsonElement projectResponseData = JsonDocument.Parse(projectData.ToStream()).RootElement; + + if (!projectResponseData.TryGetProperty("name", out var projectNameJson)) + { + Assert.Fail($"The JSON response received from the service does not include the necessary property: {"name"}"); + } + + string projectName = projectNameJson.ToString(); + Assert.AreEqual(TestEnvironment.ProjectName, projectName); + } + + Assert.AreEqual(1, numberOfReturnedProjects); + } + + [RecordedTest] + public async Task GetProjectSucceeds() + { + Response getProjectResponse = await _devCenterClient.GetProjectAsync(TestEnvironment.ProjectName); + + JsonElement getProjectData = JsonDocument.Parse(getProjectResponse.ContentStream).RootElement; + + if (!getProjectData.TryGetProperty("name", out var projectNameJson)) + { + Assert.Fail($"The JSON 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/DevCenterTestUserCredential.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterTestUserCredential.cs deleted file mode 100644 index bae466da5e10..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/DevCenterTestUserCredential.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Security; -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 _userId; - private readonly string _userSecret; - private readonly string _userName; - private readonly string[] _dataplaneScopes; - - public DevCenterTestUserCredential(string clientId, string clientSecret, string userId, string userSecret, string userName, string dataplaneScope, Uri authority) - { - _clientId = clientId; - _clientSecret = clientSecret; - _userId = userId; - _userSecret = userSecret; - _userName = userName; - _authority = authority; - _dataplaneScopes = new string[] { dataplaneScope }; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Reliability", "CA2012:Use ValueTasks correctly", Justification = "")] - public override AccessToken GetToken(TokenRequestContext requestContext, CancellationToken cancellationToken) - { - AccessToken accessToken = GetTokenAsync(requestContext, cancellationToken).GetAwaiter().GetResult(); - return accessToken; - } - - public override async ValueTask GetTokenAsync(TokenRequestContext requestContext, CancellationToken cancellationToken) - { - IPublicClientApplication app = PublicClientApplicationBuilder.Create(_clientId) - .WithAuthority(_authority) - .Build(); - - AuthenticationResult result1 = await app.AcquireTokenByUsernamePassword(new string[] { $"api://{_clientId}/devCenterSdkTest" }, _userName, _userSecret).ExecuteAsync(); - - IConfidentialClientApplication app2 = ConfidentialClientApplicationBuilder.Create(_clientId) - .WithAuthority(_authority) - .WithClientSecret(_clientSecret) - .Build(); - AuthenticationResult result2 = await app2.AcquireTokenOnBehalfOf(_dataplaneScopes, new UserAssertion(result1.AccessToken)).ExecuteAsync(); - - return new AccessToken(result2.AccessToken, result2.ExpiresOn); - } - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentCreateTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentCreateTests.cs deleted file mode 100644 index 288b14d519e8..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentCreateTests.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.IO; -using System.Net.Http; -using System.Text.Json; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.Core.TestFramework; -using NUnit.Framework; - -namespace Azure.Developer.DevCenter.Tests -{ - public class EnvironmentCreateTests : RecordedTestBase - { - public EnvironmentCreateTests(bool isAsync) : base(isAsync) - { - } - - private EnvironmentsClient GetEnvironmentsClient() => - InstrumentClient(new EnvironmentsClient( - TestEnvironment.Endpoint, - TestEnvironment.ProjectName, - TestEnvironment.Credential, - InstrumentClientOptions(new DevCenterClientOptions()))); - - [RecordedTest] - [PlaybackOnly("Environment creation is unstable due to service issues currently under investigation")] - public async Task EnvironmentCreationSucceeds() - { - EnvironmentsClient environmentsClient = GetEnvironmentsClient(); - string catalogItemName = null; - - await foreach (BinaryData catalogItemData in environmentsClient.GetCatalogItemsAsync(null, new RequestContext())) - { - JsonElement catalogItem = JsonDocument.Parse(catalogItemData.ToStream()).RootElement; - catalogItemName = catalogItem.GetProperty("name").ToString(); - } - - var content = new - { - catalogItemName = catalogItemName, - catalogName = TestEnvironment.CatalogName, - environmentType = TestEnvironment.EnvironmentTypeName, - }; - - Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "DevTestEnv", RequestContent.Create(content)); - BinaryData environmentData = await environmentCreateOperation.WaitForCompletionAsync(); - JsonElement environment = JsonDocument.Parse(environmentData.ToStream()).RootElement; - Console.WriteLine($"Started provisioning for environment with status {environment.GetProperty("provisioningState")}."); - Console.WriteLine($"Completed provisioning for environment with status {environment.GetProperty("provisioningState")}."); - - Assert.IsTrue(environment.GetProperty("provisioningState").ToString().Equals("Succeeded", StringComparison.OrdinalIgnoreCase)); - - // Delete the dev box - Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync(WaitUntil.Started, "me", "DevTestEnv"); - await environmentDeleteOperation.WaitForCompletionResponseAsync(); - Console.WriteLine($"Completed environment deletion."); - } - - #region Helpers - - private static BinaryData GetContentFromResponse(Response r) - { - // Workaround azure/azure-sdk-for-net#21048, which prevents .Content from working when dealing with responses - // from the playback system. - - MemoryStream ms = new MemoryStream(); - r.ContentStream.CopyTo(ms); - return new BinaryData(ms.ToArray()); - } - #endregion - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs new file mode 100644 index 000000000000..f1b854c26ca9 --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/EnvironmentsClientTests.cs @@ -0,0 +1,283 @@ +// 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 DevCenterClientOptions()))); + + 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)) + { + 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); + 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)) + { + 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)) + { + 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)) + { + 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); + 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)) + { + 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)) + { + 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)) + { + 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 new file mode 100644 index 000000000000..0ea4c0fb1bad --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs @@ -0,0 +1,915 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Developer.DevCenter; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Developer.DevCenter.Samples +{ + public class Samples_DeploymentEnvironmentsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironment() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironment("", "me", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironment_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentAsync("", "me", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironment_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironment("", "me", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("user").ToString()); + Console.WriteLine(result.GetProperty("provisioningState").ToString()); + Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + 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("parameters").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironment_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentAsync("", "me", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("user").ToString()); + Console.WriteLine(result.GetProperty("provisioningState").ToString()); + Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + 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("parameters").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetCatalog() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetCatalog("", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetCatalog_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetCatalogAsync("", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetCatalog_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetCatalog("", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetCatalog_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetCatalogAsync("", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinition() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironmentDefinition("", "", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinition_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinition_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = client.GetEnvironmentDefinition("", "", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result.GetProperty("parametersSchema").ToString()); + Console.WriteLine(result.GetProperty("templatePath").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinition_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Response response = await client.GetEnvironmentDefinitionAsync("", "", ""); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result.GetProperty("parametersSchema").ToString()); + Console.WriteLine(result.GetProperty("templatePath").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAllEnvironments() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllEnvironments("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllEnvironments_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllEnvironmentsAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAllEnvironments_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllEnvironments("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllEnvironments_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllEnvironmentsAsync("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironments() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironments("", "me")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironments_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentsAsync("", "me")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironments_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironments("", "me", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironments_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentsAsync("", "me", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("environmentType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("parameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetCatalogs() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetCatalogs("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetCatalogs_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetCatalogsAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetCatalogs_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetCatalogs("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetCatalogs_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetCatalogsAsync("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinitions() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentDefinitions("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinitions_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinitions_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentDefinitions("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinitions_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentDefinitionsAsync("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinitionsByCatalog() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinitionsByCatalog_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentDefinitionsByCatalog_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalog("", "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentDefinitionsByCatalog_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentDefinitionsByCatalogAsync("", "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("catalogName").ToString()); + Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); + Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); + Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); + Console.WriteLine(result[0].GetProperty("templatePath").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentTypes() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentTypes("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentTypes_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentTypesAsync("")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetEnvironmentTypes_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + foreach (BinaryData item in client.GetEnvironmentTypes("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetEnvironmentTypes_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + await foreach (BinaryData item in client.GetEnvironmentTypesAsync("", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); + Console.WriteLine(result[0].GetProperty("status").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrUpdateEnvironment() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + RequestContent content = RequestContent.Create(new + { + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + }); + Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "me", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrUpdateEnvironment_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + RequestContent content = RequestContent.Create(new + { + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + }); + Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "me", "", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("environmentType").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrUpdateEnvironment_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + RequestContent content = RequestContent.Create(new + { + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + parameters = new object(), + }); + Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "", "me", "", content); + 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("user").ToString()); + Console.WriteLine(result.GetProperty("provisioningState").ToString()); + Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + 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("parameters").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CreateOrUpdateEnvironment_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + RequestContent content = RequestContent.Create(new + { + environmentType = "", + catalogName = "", + environmentDefinitionName = "", + parameters = new object(), + }); + Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "", "me", "", content); + 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("user").ToString()); + Console.WriteLine(result.GetProperty("provisioningState").ToString()); + Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); + Console.WriteLine(result.GetProperty("catalogName").ToString()); + Console.WriteLine(result.GetProperty("environmentDefinitionName").ToString()); + 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("parameters").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteEnvironment() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteEnvironment_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteEnvironment_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteEnvironment_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); + + Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").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 1fd76ac94569..c77a4f7f7481 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 @@ -24,12 +24,14 @@ public void Example_GetPool() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetPool("", null); + Response response = client.GetPool("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("location").ToString()); + Console.WriteLine(result.GetProperty("healthStatus").ToString()); } [Test] @@ -38,12 +40,14 @@ public async Task Example_GetPool_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetPoolAsync("", null); + Response response = await client.GetPoolAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("location").ToString()); + Console.WriteLine(result.GetProperty("healthStatus").ToString()); } [Test] @@ -52,9 +56,9 @@ public void Example_GetPool_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetPool("", null); + Response response = client.GetPool("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -71,6 +75,9 @@ public void Example_GetPool_AllParameters() Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString()); 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()); } [Test] @@ -79,9 +86,9 @@ public async Task Example_GetPool_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetPoolAsync("", null); + Response response = await client.GetPoolAsync("", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -98,45 +105,56 @@ public async Task Example_GetPool_AllParameters_Async() Console.WriteLine(result.GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result.GetProperty("imageReference").GetProperty("publishedDate").ToString()); 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()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetScheduleByPool() + public void Example_GetSchedule() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetScheduleByPool("", "", null); + Response response = client.GetSchedule("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + 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_GetScheduleByPool_Async() + public async Task Example_GetSchedule_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetScheduleByPoolAsync("", "", null); + Response response = await client.GetScheduleAsync("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + 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_GetScheduleByPool_AllParameters() + public void Example_GetSchedule_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetScheduleByPool("", "", null); + Response response = client.GetSchedule("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -148,13 +166,13 @@ public void Example_GetScheduleByPool_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetScheduleByPool_AllParameters_Async() + public async Task Example_GetSchedule_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetScheduleByPoolAsync("", "", null); + Response response = await client.GetScheduleAsync("", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -166,13 +184,13 @@ public async Task Example_GetScheduleByPool_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDevBoxByUser() + public void Example_GetDevBox() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetDevBoxByUser("me", "", null); + Response response = client.GetDevBox("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("poolName").ToString()); @@ -180,13 +198,13 @@ public void Example_GetDevBoxByUser() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDevBoxByUser_Async() + public async Task Example_GetDevBox_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetDevBoxByUserAsync("me", "", null); + Response response = await client.GetDevBoxAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("poolName").ToString()); @@ -194,13 +212,13 @@ public async Task Example_GetDevBoxByUser_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDevBoxByUser_AllParameters() + public void Example_GetDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetDevBoxByUser("me", "", null); + Response response = client.GetDevBox("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -211,8 +229,9 @@ public void Example_GetDevBoxByUser_AllParameters() Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); + 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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -231,13 +250,13 @@ public void Example_GetDevBoxByUser_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDevBoxByUser_AllParameters_Async() + public async Task Example_GetDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetDevBoxByUserAsync("me", "", null); + Response response = await client.GetDevBoxAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -248,8 +267,9 @@ public async Task Example_GetDevBoxByUser_AllParameters_Async() Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); + 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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -272,9 +292,9 @@ public void Example_GetRemoteConnection() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetRemoteConnection("me", "", null); + Response response = client.GetRemoteConnection("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -286,9 +306,9 @@ public async Task Example_GetRemoteConnection_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetRemoteConnectionAsync("me", "", null); + Response response = await client.GetRemoteConnectionAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -300,9 +320,9 @@ public void Example_GetRemoteConnection_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetRemoteConnection("me", "", null); + Response response = client.GetRemoteConnection("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("webUrl").ToString()); @@ -315,9 +335,9 @@ public async Task Example_GetRemoteConnection_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetRemoteConnectionAsync("me", "", null); + Response response = await client.GetRemoteConnectionAsync("", "me", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("webUrl").ToString()); @@ -326,182 +346,186 @@ public async Task Example_GetRemoteConnection_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetUpcomingAction() + public void Example_GetAction() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetUpcomingAction("me", "", "", null); + Response response = client.GetAction("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("actionType").ToString()); + Console.WriteLine(result.GetProperty("sourceId").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetUpcomingAction_Async() + public async Task Example_GetAction_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetUpcomingActionAsync("me", "", "", null); + Response response = await client.GetActionAsync("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("actionType").ToString()); + Console.WriteLine(result.GetProperty("sourceId").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetUpcomingAction_AllParameters() + public void Example_GetAction_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.GetUpcomingAction("me", "", "", null); + Response response = client.GetAction("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); - Console.WriteLine(result.GetProperty("reason").ToString()); - Console.WriteLine(result.GetProperty("scheduledTime").ToString()); - Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); + Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetUpcomingAction_AllParameters_Async() + public async Task Example_GetAction_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.GetUpcomingActionAsync("me", "", "", null); + Response response = await client.GetActionAsync("", "me", "", ""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); - Console.WriteLine(result.GetProperty("reason").ToString()); - Console.WriteLine(result.GetProperty("scheduledTime").ToString()); - Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); + Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SkipUpcomingAction() + public void Example_SkipAction() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.SkipUpcomingAction("me", "", ""); + Response response = client.SkipAction("", "me", "", ""); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SkipUpcomingAction_Async() + public async Task Example_SkipAction_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.SkipUpcomingActionAsync("me", "", ""); + Response response = await client.SkipActionAsync("", "me", "", ""); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SkipUpcomingAction_AllParameters() + public void Example_SkipAction_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.SkipUpcomingAction("me", "", ""); + Response response = client.SkipAction("", "me", "", ""); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SkipUpcomingAction_AllParameters_Async() + public async Task Example_SkipAction_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.SkipUpcomingActionAsync("me", "", ""); + Response response = await client.SkipActionAsync("", "me", "", ""); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DelayUpcomingAction() + public void Example_DelayAction() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.DelayUpcomingAction("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); + Response response = client.DelayAction("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("actionType").ToString()); + Console.WriteLine(result.GetProperty("sourceId").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DelayUpcomingAction_Async() + public async Task Example_DelayAction_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.DelayUpcomingActionAsync("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); + Response response = await client.DelayActionAsync("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("actionType").ToString()); + Console.WriteLine(result.GetProperty("sourceId").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DelayUpcomingAction_AllParameters() + public void Example_DelayAction_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = client.DelayUpcomingAction("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); + Response response = client.DelayAction("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); - Console.WriteLine(result.GetProperty("reason").ToString()); - Console.WriteLine(result.GetProperty("scheduledTime").ToString()); - Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); + Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DelayUpcomingAction_AllParameters_Async() + public async Task Example_DelayAction_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Response response = await client.DelayUpcomingActionAsync("me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"), null); + Response response = await client.DelayActionAsync("", "me", "", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z")); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("actionType").ToString()); - Console.WriteLine(result.GetProperty("reason").ToString()); - Console.WriteLine(result.GetProperty("scheduledTime").ToString()); - Console.WriteLine(result.GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result.GetProperty("sourceId").ToString()); + Console.WriteLine(result.GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result.GetProperty("next").GetProperty("scheduledTime").ToString()); } [Test] @@ -510,12 +534,14 @@ public void Example_GetPools() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetPools(null, null, null)) + foreach (BinaryData item in client.GetPools("")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } } @@ -525,12 +551,14 @@ public async Task Example_GetPools_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetPoolsAsync(null, null, null)) + await foreach (BinaryData item in client.GetPoolsAsync("")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } } @@ -540,9 +568,9 @@ public void Example_GetPools_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetPools(1234, "", null)) + foreach (BinaryData item in client.GetPools("", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -559,6 +587,9 @@ public void Example_GetPools_AllParameters() Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("gracePeriodMinutes").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } } @@ -568,9 +599,9 @@ public async Task Example_GetPools_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetPoolsAsync(1234, "", null)) + await foreach (BinaryData item in client.GetPoolsAsync("", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -587,48 +618,59 @@ public async Task Example_GetPools_AllParameters_Async() Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("status").ToString()); + Console.WriteLine(result[0].GetProperty("stopOnDisconnect").GetProperty("gracePeriodMinutes").ToString()); + Console.WriteLine(result[0].GetProperty("healthStatus").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSchedulesByPool() + public void Example_GetSchedules() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetSchedulesByPool("", null, null, null)) + foreach (BinaryData item in client.GetSchedules("", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("frequency").ToString()); + Console.WriteLine(result[0].GetProperty("time").ToString()); + Console.WriteLine(result[0].GetProperty("timeZone").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSchedulesByPool_Async() + public async Task Example_GetSchedules_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetSchedulesByPoolAsync("", null, null, null)) + await foreach (BinaryData item in client.GetSchedulesAsync("", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("type").ToString()); + Console.WriteLine(result[0].GetProperty("frequency").ToString()); + Console.WriteLine(result[0].GetProperty("time").ToString()); + Console.WriteLine(result[0].GetProperty("timeZone").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetSchedulesByPool_AllParameters() + public void Example_GetSchedules_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetSchedulesByPool("", 1234, "", null)) + foreach (BinaryData item in client.GetSchedules("", "", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -641,13 +683,13 @@ public void Example_GetSchedulesByPool_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetSchedulesByPool_AllParameters_Async() + public async Task Example_GetSchedules_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetSchedulesByPoolAsync("", 1234, "", null)) + await foreach (BinaryData item in client.GetSchedulesAsync("", "", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -660,13 +702,229 @@ public async Task Example_GetSchedulesByPool_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDevBoxesByUser() + public void Example_GetAllDevBoxes() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllDevBoxes()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllDevBoxes_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllDevBoxesAsync()) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAllDevBoxes_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllDevBoxes(filter: "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllDevBoxes_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllDevBoxesAsync(filter: "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAllDevBoxesByUser() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllDevBoxesByUser("me")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllDevBoxesByUser_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me")) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAllDevBoxesByUser_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetAllDevBoxesByUser("me", filter: "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetAllDevBoxesByUser_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetDevBoxesByUser("me", null, null, null)) + await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", filter: "", maxCount: 1234)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("projectName").ToString()); + Console.WriteLine(result[0].GetProperty("poolName").ToString()); + Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); + Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); + Console.WriteLine(result[0].GetProperty("actionState").ToString()); + Console.WriteLine(result[0].GetProperty("powerState").ToString()); + Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result[0].GetProperty("location").ToString()); + Console.WriteLine(result[0].GetProperty("osType").ToString()); + Console.WriteLine(result[0].GetProperty("user").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); + Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); + Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); + Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); + Console.WriteLine(result[0].GetProperty("createdTime").ToString()); + Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDevBoxes() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.GetDevBoxes("", "me")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("poolName").ToString()); @@ -675,13 +933,13 @@ public void Example_GetDevBoxesByUser() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDevBoxesByUser_Async() + public async Task Example_GetDevBoxes_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", null, null, null)) + await foreach (BinaryData item in client.GetDevBoxesAsync("", "me")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("poolName").ToString()); @@ -690,13 +948,13 @@ public async Task Example_GetDevBoxesByUser_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetDevBoxesByUser_AllParameters() + public void Example_GetDevBoxes_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetDevBoxesByUser("me", "", 1234, null)) + foreach (BinaryData item in client.GetDevBoxes("", "me", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -707,8 +965,9 @@ public void Example_GetDevBoxesByUser_AllParameters() Console.WriteLine(result[0].GetProperty("actionState").ToString()); Console.WriteLine(result[0].GetProperty("powerState").ToString()); Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); Console.WriteLine(result[0].GetProperty("location").ToString()); Console.WriteLine(result[0].GetProperty("osType").ToString()); Console.WriteLine(result[0].GetProperty("user").ToString()); @@ -728,13 +987,13 @@ public void Example_GetDevBoxesByUser_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetDevBoxesByUser_AllParameters_Async() + public async Task Example_GetDevBoxes_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetDevBoxesByUserAsync("me", "", 1234, null)) + await foreach (BinaryData item in client.GetDevBoxesAsync("", "me", filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); @@ -745,8 +1004,9 @@ public async Task Example_GetDevBoxesByUser_AllParameters_Async() Console.WriteLine(result[0].GetProperty("actionState").ToString()); Console.WriteLine(result[0].GetProperty("powerState").ToString()); Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); Console.WriteLine(result[0].GetProperty("location").ToString()); Console.WriteLine(result[0].GetProperty("osType").ToString()); Console.WriteLine(result[0].GetProperty("user").ToString()); @@ -766,71 +1026,153 @@ public async Task Example_GetDevBoxesByUser_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetUpcomingActions() + public void Example_GetActions() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetUpcomingActions("me", "", null)) + foreach (BinaryData item in client.GetActions("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("sourceId").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetUpcomingActions_Async() + public async Task Example_GetActions_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetUpcomingActionsAsync("me", "", null)) + await foreach (BinaryData item in client.GetActionsAsync("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("sourceId").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetUpcomingActions_AllParameters() + public void Example_GetActions_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - foreach (BinaryData item in client.GetUpcomingActions("me", "", null)) + foreach (BinaryData item in client.GetActions("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("actionType").ToString()); - Console.WriteLine(result[0].GetProperty("reason").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTime").ToString()); - Console.WriteLine(result[0].GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result[0].GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("next").GetProperty("scheduledTime").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_GetUpcomingActions_AllParameters_Async() + public async Task Example_GetActions_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - await foreach (BinaryData item in client.GetUpcomingActionsAsync("me", "", null)) + await foreach (BinaryData item in client.GetActionsAsync("", "me", "")) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("actionType").ToString()); - Console.WriteLine(result[0].GetProperty("reason").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTime").ToString()); - Console.WriteLine(result[0].GetProperty("originalScheduledTime").ToString()); Console.WriteLine(result[0].GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("next").GetProperty("scheduledTime").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DelayAllActions() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.DelayAllActions("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DelayAllActions_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.DelayAllActionsAsync("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DelayAllActions_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + foreach (BinaryData item in client.DelayAllActions("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("next").GetProperty("scheduledTime").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DelayAllActions_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + await foreach (BinaryData item in client.DelayAllActionsAsync("", "me", "", DateTimeOffset.Parse("2022-05-10T18:57:31.2311892Z"))) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result[0].GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("result").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("name").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("actionType").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("sourceId").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("suspendedUntil").ToString()); + Console.WriteLine(result[0].GetProperty("action").GetProperty("next").GetProperty("scheduledTime").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result[0].GetProperty("error").GetProperty("target").ToString()); } } @@ -840,13 +1182,13 @@ public void Example_CreateDevBox() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", }); - Operation operation = client.CreateDevBox(WaitUntil.Completed, "me", "", content); + Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -859,13 +1201,13 @@ public async Task Example_CreateDevBox_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", }); - Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "me", "", content); + Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -878,14 +1220,14 @@ public void Example_CreateDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", localAdministrator = "Enabled", }); - Operation operation = client.CreateDevBox(WaitUntil.Completed, "me", "", content); + Operation operation = client.CreateDevBox(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -897,8 +1239,9 @@ public void Example_CreateDevBox_AllParameters() Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); + 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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -921,14 +1264,14 @@ public async Task Example_CreateDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); RequestContent content = RequestContent.Create(new { poolName = "", localAdministrator = "Enabled", }); - Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "me", "", content); + Operation operation = await client.CreateDevBoxAsync(WaitUntil.Completed, "", "me", "", content); BinaryData responseData = operation.Value; JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; @@ -940,8 +1283,9 @@ public async Task Example_CreateDevBox_AllParameters_Async() Console.WriteLine(result.GetProperty("actionState").ToString()); Console.WriteLine(result.GetProperty("powerState").ToString()); Console.WriteLine(result.GetProperty("uniqueId").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errorDetails").GetProperty("message").ToString()); + 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("location").ToString()); Console.WriteLine(result.GetProperty("osType").ToString()); Console.WriteLine(result.GetProperty("user").ToString()); @@ -964,9 +1308,13 @@ public void Example_DeleteDevBox() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = client.DeleteDevBox(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -975,9 +1323,13 @@ public async Task Example_DeleteDevBox_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "me", ""); + Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -986,9 +1338,22 @@ public void Example_DeleteDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = client.DeleteDevBox(WaitUntil.Completed, "me", ""); + Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } [Test] @@ -997,9 +1362,22 @@ public async Task Example_DeleteDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "me", ""); + Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } [Test] @@ -1008,9 +1386,13 @@ public void Example_StartDevBox() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.StartDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = client.StartDevBox(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -1019,9 +1401,13 @@ public async Task Example_StartDevBox_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -1030,9 +1416,22 @@ public void Example_StartDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.StartDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = client.StartDevBox(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } [Test] @@ -1041,9 +1440,22 @@ public async Task Example_StartDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "me", ""); + Operation operation = await client.StartDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } [Test] @@ -1052,9 +1464,13 @@ public void Example_StopDevBox() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.StopDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = client.StopDevBox(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -1063,9 +1479,13 @@ public async Task Example_StopDevBox_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; - Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "me", ""); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); } [Test] @@ -1074,9 +1494,22 @@ public void Example_StopDevBox_AllParameters() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.StopDevBox(WaitUntil.Completed, "", "me", "", hibernate: true); + BinaryData responseData = operation.Value; - Operation operation = client.StopDevBox(WaitUntil.Completed, "me", "", hibernate: true); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } [Test] @@ -1085,9 +1518,100 @@ public async Task Example_StopDevBox_AllParameters_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); - DevBoxesClient client = new DevBoxesClient(endpoint, "", credential); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "", "me", "", hibernate: true); + BinaryData responseData = operation.Value; - Operation operation = await client.StopDevBoxAsync(WaitUntil.Completed, "me", "", hibernate: true); + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RestartDevBox() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.RestartDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RestartDevBox_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = await client.RestartDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RestartDevBox_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = client.RestartDevBox(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RestartDevBox_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + DevBoxesClient client = new DevBoxesClient(endpoint, credential); + + Operation operation = await client.RestartDevBoxAsync(WaitUntil.Completed, "", "me", ""); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("resourceId").ToString()); + Console.WriteLine(result.GetProperty("startTime").ToString()); + Console.WriteLine(result.GetProperty("endTime").ToString()); + Console.WriteLine(result.GetProperty("percentComplete").ToString()); + Console.WriteLine(result.GetProperty("properties").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); } } } 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 90d19ff68686..d1648183574c 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 @@ -26,10 +26,10 @@ public void Example_GetProject() TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - Response response = client.GetProject("", null); + Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] @@ -40,10 +40,10 @@ public async Task Example_GetProject_Async() TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - Response response = await client.GetProjectAsync("", null); + Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); } [Test] @@ -54,11 +54,12 @@ public void Example_GetProject_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - Response response = client.GetProject("", null); + Response response = client.GetProject(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); } [Test] @@ -69,11 +70,12 @@ public async Task Example_GetProject_AllParameters_Async() TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - Response response = await client.GetProjectAsync("", null); + Response response = await client.GetProjectAsync(""); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("maxDevBoxesPerUser").ToString()); } [Test] @@ -84,10 +86,10 @@ public void Example_GetProjects() 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()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } } @@ -99,10 +101,10 @@ public async Task Example_GetProjects_Async() 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()) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); + Console.WriteLine(result[0].GetProperty("name").ToString()); } } @@ -114,11 +116,12 @@ public void Example_GetProjects_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DevCenterClient client = new DevCenterClient(endpoint, credential); - foreach (BinaryData item in client.GetProjects("", 1234, null)) + foreach (BinaryData item in client.GetProjects(filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("description").ToString()); + Console.WriteLine(result[0].GetProperty("maxDevBoxesPerUser").ToString()); } } @@ -130,223 +133,12 @@ public async Task Example_GetProjects_AllParameters_Async() 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(filter: "", maxCount: 1234)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result[0].GetProperty("name").ToString()); Console.WriteLine(result[0].GetProperty("description").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetAllDevBoxes() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - foreach (BinaryData item in client.GetAllDevBoxes(null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetAllDevBoxes_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - await foreach (BinaryData item in client.GetAllDevBoxesAsync(null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetAllDevBoxes_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - foreach (BinaryData item in client.GetAllDevBoxes("", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetAllDevBoxes_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - await foreach (BinaryData item in client.GetAllDevBoxesAsync("", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetAllDevBoxesByUser() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - foreach (BinaryData item in client.GetAllDevBoxesByUser("me", null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetAllDevBoxesByUser_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", null, null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetAllDevBoxesByUser_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - foreach (BinaryData item in client.GetAllDevBoxesByUser("me", "", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetAllDevBoxesByUser_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - DevCenterClient client = new DevCenterClient(endpoint, credential); - - await foreach (BinaryData item in client.GetAllDevBoxesByUserAsync("me", "", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("projectName").ToString()); - Console.WriteLine(result[0].GetProperty("poolName").ToString()); - Console.WriteLine(result[0].GetProperty("hibernateSupport").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("actionState").ToString()); - Console.WriteLine(result[0].GetProperty("powerState").ToString()); - Console.WriteLine(result[0].GetProperty("uniqueId").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("code").ToString()); - Console.WriteLine(result[0].GetProperty("errorDetails").GetProperty("message").ToString()); - Console.WriteLine(result[0].GetProperty("location").ToString()); - Console.WriteLine(result[0].GetProperty("osType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("skuName").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("vCPUs").ToString()); - Console.WriteLine(result[0].GetProperty("hardwareProfile").GetProperty("memoryGB").ToString()); - Console.WriteLine(result[0].GetProperty("storageProfile").GetProperty("osDisk").GetProperty("diskSizeGB").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("operatingSystem").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("osBuildNumber").ToString()); - Console.WriteLine(result[0].GetProperty("imageReference").GetProperty("publishedDate").ToString()); - Console.WriteLine(result[0].GetProperty("createdTime").ToString()); - Console.WriteLine(result[0].GetProperty("localAdministrator").ToString()); + Console.WriteLine(result[0].GetProperty("maxDevBoxesPerUser").ToString()); } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_EnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_EnvironmentsClient.cs deleted file mode 100644 index 9779401c4e0d..000000000000 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_EnvironmentsClient.cs +++ /dev/null @@ -1,1141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Developer.DevCenter; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.Developer.DevCenter.Samples -{ - public class Samples_EnvironmentsClient - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentByUser() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetEnvironmentByUser("me", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentByUser_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetEnvironmentByUserAsync("me", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentByUser_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetEnvironmentByUser("me", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.GetProperty("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentByUser_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetEnvironmentByUserAsync("me", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.GetProperty("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateEnvironment() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new object()); - Response response = client.UpdateEnvironment("me", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateEnvironment_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new object()); - Response response = await client.UpdateEnvironmentAsync("me", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_UpdateEnvironment_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, - }); - Response response = client.UpdateEnvironment("me", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.GetProperty("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_UpdateEnvironment_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, - }); - Response response = await client.UpdateEnvironmentAsync("me", "", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.GetProperty("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItem() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetCatalogItem("", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItem_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetCatalogItemAsync("", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItem_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetCatalogItem("", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItem_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetCatalogItemAsync("", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItemVersion() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetCatalogItemVersion("", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItemVersion_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetCatalogItemVersionAsync("", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItemVersion_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = client.GetCatalogItemVersion("", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("catalogItemId").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("summary").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("templatePath").ToString()); - Console.WriteLine(result.GetProperty("parametersSchema").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result.GetProperty("runner").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("eligibleForLatestVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItemVersion_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Response response = await client.GetCatalogItemVersionAsync("", "", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("catalogItemId").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("version").ToString()); - Console.WriteLine(result.GetProperty("summary").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("templatePath").ToString()); - Console.WriteLine(result.GetProperty("parametersSchema").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result.GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result.GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result.GetProperty("runner").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("eligibleForLatestVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironments() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironments(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironments_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentsAsync(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironments_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironments(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironments_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentsAsync(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentsByUser() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironmentsByUser("me", null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentsByUser_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentsByUserAsync("me", null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentsByUser_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironmentsByUser("me", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentsByUser_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentsByUserAsync("me", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("environmentType").ToString()); - Console.WriteLine(result[0].GetProperty("user").ToString()); - Console.WriteLine(result[0].GetProperty("provisioningState").ToString()); - Console.WriteLine(result[0].GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("parameters").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result[0].GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result[0].GetProperty("tags").GetProperty("").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItems() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetCatalogItems(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItems_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetCatalogItemsAsync(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItems_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetCatalogItems(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItems_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetCatalogItemsAsync(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItemVersions() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetCatalogItemVersions("", null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItemVersions_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetCatalogItemVersionsAsync("", null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetCatalogItemVersions_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetCatalogItemVersions("", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("catalogItemId").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("summary").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("templatePath").ToString()); - Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - Console.WriteLine(result[0].GetProperty("eligibleForLatestVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetCatalogItemVersions_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetCatalogItemVersionsAsync("", 1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("catalogItemId").ToString()); - Console.WriteLine(result[0].GetProperty("catalogItemName").ToString()); - Console.WriteLine(result[0].GetProperty("catalogName").ToString()); - Console.WriteLine(result[0].GetProperty("version").ToString()); - Console.WriteLine(result[0].GetProperty("summary").ToString()); - Console.WriteLine(result[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("templatePath").ToString()); - Console.WriteLine(result[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parametersSchema").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("description").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("default").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("readOnly").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("required").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("parameters")[0].GetProperty("allowed")[0].ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("type").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("typeName").ToString()); - Console.WriteLine(result[0].GetProperty("actions")[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("runner").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - Console.WriteLine(result[0].GetProperty("eligibleForLatestVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentTypes() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironmentTypes(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentTypes_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentTypesAsync(null, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetEnvironmentTypes_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - foreach (BinaryData item in client.GetEnvironmentTypes(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetEnvironmentTypes_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - await foreach (BinaryData item in client.GetEnvironmentTypesAsync(1234, null)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result[0].GetProperty("name").ToString()); - Console.WriteLine(result[0].GetProperty("deploymentTargetId").ToString()); - Console.WriteLine(result[0].GetProperty("status").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateOrUpdateEnvironment() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - environmentType = "", - }); - Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "me", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateOrUpdateEnvironment_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - environmentType = "", - }); - Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("environmentType").ToString()); - Console.WriteLine(result.ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateOrUpdateEnvironment_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - environmentType = "", - user = "", - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, - }); - Operation operation = client.CreateOrUpdateEnvironment(WaitUntil.Completed, "me", "", content); - 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("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateOrUpdateEnvironment_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - environmentType = "", - user = "", - description = "", - catalogName = "", - catalogItemName = "", - parameters = new object(), - scheduledTasks = new - { - key = new - { - type = "AutoExpire", - enabled = "Enabled", - startTime = "2022-05-10T18:57:31.2311892Z", - }, - }, - tags = new - { - key = "", - }, - }); - Operation operation = await client.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "", content); - 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("user").ToString()); - Console.WriteLine(result.GetProperty("provisioningState").ToString()); - Console.WriteLine(result.GetProperty("resourceGroupId").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("catalogName").ToString()); - Console.WriteLine(result.GetProperty("catalogItemName").ToString()); - Console.WriteLine(result.GetProperty("parameters").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("type").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("enabled").ToString()); - Console.WriteLine(result.GetProperty("scheduledTasks").GetProperty("").GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteEnvironment() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "me", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteEnvironment_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "me", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteEnvironment_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "me", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteEnvironment_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "me", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeployEnvironmentAction() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - }); - Operation operation = client.DeployEnvironmentAction(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeployEnvironmentAction_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - }); - Operation operation = await client.DeployEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeployEnvironmentAction_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - parameters = new object(), - }); - Operation operation = client.DeployEnvironmentAction(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeployEnvironmentAction_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - parameters = new object(), - }); - Operation operation = await client.DeployEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CustomEnvironmentAction() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - }); - Operation operation = client.CustomEnvironmentAction(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CustomEnvironmentAction_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - }); - Operation operation = await client.CustomEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CustomEnvironmentAction_AllParameters() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - parameters = new object(), - }); - Operation operation = client.CustomEnvironmentAction(WaitUntil.Completed, "me", "", content); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CustomEnvironmentAction_AllParameters_Async() - { - Uri endpoint = new Uri(""); - TokenCredential credential = new DefaultAzureCredential(); - EnvironmentsClient client = new EnvironmentsClient(endpoint, "", credential); - - RequestContent content = RequestContent.Create(new - { - actionId = "", - parameters = new object(), - }); - Operation operation = await client.CustomEnvironmentActionAsync(WaitUntil.Completed, "me", "", content); - } - } -} diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs new file mode 100644 index 000000000000..e7042ee9e5ef --- /dev/null +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateClients.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using Azure.Core.TestFramework; + +namespace Azure.Developer.DevCenter.Tests.Samples +{ + public partial class DevCenterSamples : SamplesBase + { + public void CreateClients(Uri endpoint) + { + #region Snippet:Azure_DevCenter_CreateClients_Scenario + var credential = new DefaultAzureCredential(); + + var devCenterClient = new DevCenterClient(endpoint, credential); + var devBoxesClient = new DevBoxesClient(endpoint, credential); + var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); + #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 index 4cabbd5806d8..a4b6782d4e52 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteDevBoxAsync.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteDevBoxAsync.cs @@ -2,12 +2,10 @@ // Licensed under the MIT License. using System; -using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; -using NUnit.Framework; namespace Azure.Developer.DevCenter.Tests.Samples { @@ -16,11 +14,12 @@ public partial class DevCenterSamples: SamplesBase devBoxCreateOperation = await devBoxesClient.CreateDevBoxAsync(WaitUntil.Completed, "me", "MyDevBox", RequestContent.Create(content)); + 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")}."); @@ -63,14 +70,21 @@ public async Task CreateDeleteDevBoxAsync(Uri endpoint) // Fetch the web connection URL to access your dev box from the browser #region Snippet:Azure_DevCenter_ConnectToDevBox_Scenario - Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync("me", "MyDevBox", new()); + Response remoteConnectionResponse = await devBoxesClient.GetRemoteConnectionAsync( + targetProjectName, + "me", + "MyDevBox"); 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, "me", "MyDevBox"); + 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/Samples/Sample_CreateDeleteEnvironmentAsync.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs index 76eb0dd808bc..a917ee057b94 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Samples/Sample_CreateDeleteEnvironmentAsync.cs @@ -2,13 +2,10 @@ // Licensed under the MIT License. using System; -using System.Linq; using System.Text.Json; using System.Threading.Tasks; using Azure.Core; using Azure.Core.TestFramework; -using Microsoft.Identity.Client.Platforms.Features.DesktopOs.Kerberos; -using NUnit.Framework; namespace Azure.Developer.DevCenter.Tests.Samples { @@ -20,7 +17,7 @@ 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(filter: null, maxCount: 1, context: new())) + await foreach (BinaryData data in devCenterClient.GetProjectsAsync()) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; projectName = result.GetProperty("name").ToString(); @@ -31,24 +28,41 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) throw new InvalidOperationException($"No valid project resources found in DevCenter {endpoint}."); } - #region Snippet:Azure_DevCenter_GetCatalogItems_Scenario - var environmentsClient = new EnvironmentsClient(endpoint, projectName, credential); - string catalogItemName = null; - await foreach (BinaryData data in environmentsClient.GetCatalogItemsAsync(maxCount: 1, context: new())) + // Create deployment environments client + var environmentsClient = new DeploymentEnvironmentsClient(endpoint, credential); + + #region Snippet:Azure_DevCenter_GetCatalogs_Scenario + string catalogName = null; + + await foreach (BinaryData data in environmentsClient.GetCatalogsAsync(projectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; - catalogItemName = result.GetProperty("name").ToString(); + catalogName = result.GetProperty("name").ToString(); } #endregion - if (catalogItemName is null) + if (catalogName is null) { - throw new InvalidOperationException($"No valid catalog item resources found in Project {projectName}/DevCenter {endpoint}."); + throw new InvalidOperationException($"No valid catalog resources found in Project {projectName}/DevCenter {endpoint}."); + } + + #region 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(); + } + #endregion + + if (environmentDefinitionName is null) + { + throw new InvalidOperationException($"No valid environemtn definitions were found in Project {projectName}/DevCenter {endpoint}."); } #region Snippet:Azure_DevCenter_GetEnvironmentTypes_Scenario string environmentTypeName = null; - await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(maxCount: 1, context: new())) + await foreach (BinaryData data in environmentsClient.GetEnvironmentTypesAsync(projectName)) { JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement; environmentTypeName = result.GetProperty("name").ToString(); @@ -57,18 +71,25 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) if (environmentTypeName is null) { - throw new InvalidOperationException($"No valid catalog item resources found in Project {projectName}/DevCenter {endpoint}."); + throw new InvalidOperationException($"No valid environment type resources found in Project {projectName}/DevCenter {endpoint}."); } #region Snippet:Azure_DevCenter_CreateEnvironment_Scenario var content = new { + catalogName = catalogName, environmentType = environmentTypeName, - catalogItemName = catalogItemName, + environmentDefinitionName = environmentDefinitionName, }; // Deploy the environment - Operation environmentCreateOperation = await environmentsClient.CreateOrUpdateEnvironmentAsync(WaitUntil.Completed, "me", "DevEnvironment", RequestContent.Create(content)); + 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")}."); @@ -76,7 +97,11 @@ public async Task CreateDeleteEnvironmentAsync(Uri endpoint) // Delete the environment when finished #region Snippet:Azure_DevCenter_DeleteEnvironment_Scenario - Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync(WaitUntil.Completed, projectName, "DevEnvironment"); + Operation environmentDeleteOperation = await environmentsClient.DeleteEnvironmentAsync( + WaitUntil.Completed, + projectName, + "me", + "DevEnvironment"); await environmentDeleteOperation.WaitForCompletionResponseAsync(); Console.WriteLine($"Completed environment deletion."); #endregion diff --git a/sdk/devcenter/test-resources.bicep b/sdk/devcenter/test-resources.bicep index 967690fa7d28..eb5d7d4bc696 100644 --- a/sdk/devcenter/test-resources.bicep +++ b/sdk/devcenter/test-resources.bicep @@ -16,11 +16,12 @@ var defaultNetworkConnectionName = 'sdk-networkconnection-${uniqueString('networ var defaultNetworkConnection2Name = 'sdk-networkconnection2-${uniqueString('networkConnection', '2022-09-01-preview', baseName, resourceGroup().name)}' var defaultMarketplaceDefinition = 'sdk-devboxdefinition-${uniqueString('devboxdefinition', '2022-09-01-preview', baseName, resourceGroup().name)}' 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_a_8c32gb_v1' +var devBoxSkuName = 'general_i_16c64gb1024ssd_v2' var devBoxStorage = 'ssd_1024gb' -var marketplaceImageName = 'MicrosoftWindowsDesktop_windows-ent-cpc_win11-21h2-ent-cpc-m365' -var gitUri = 'https://github.com/Azure/fidalgoIntegrationTests.git' +var marketplaceImageName = 'microsoftvisualstudio_visualstudioplustools_vs-2022-ent-general-win11-m365-gen2' +var gitUri = 'https://github.com/Azure/deployment-environments.git' resource devcenter 'Microsoft.DevCenter/devcenters@2022-11-11-preview' = { name: defaultDevCenterName @@ -175,6 +176,20 @@ resource catalog 'Microsoft.DevCenter/devcenters/catalogs@2022-09-01-preview' = } } +resource schedule 'Microsoft.DevCenter/projects/pools/schedules@2023-01-01-preview' = { + name: '${project.name}/${defaultPoolName}/${defaultScheduleName}' + properties: { + type: 'StopDevBox' + frequency: 'Daily' + time: '19:00' + timeZone: 'America/Los_Angeles' + state: 'Enabled' + } + dependsOn: [ + project, pool + ] +} + resource environmentType 'Microsoft.DevCenter/devcenters/environmentTypes@2022-11-11-preview' = { name: '${devcenter.name}/${defaultEnvironmentTypeName}' properties: { @@ -205,6 +220,16 @@ resource environmentRoleAssignment 'Microsoft.Authorization/roleAssignments@2020 } } +resource devcenterRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = { + name: guid(resourceGroup().id, devcenter.name, projectAdminRoleDefinitionId, testUserOid) + scope: devcenter + properties: { + roleDefinitionId: resourceId('Microsoft.Authorization/roleDefinitions', projectAdminRoleDefinitionId) + principalId: testUserOid + principalType: 'User' +} +} + resource devBoxRoleAssignment 'Microsoft.Authorization/roleAssignments@2020-10-01-preview' = { name: guid(resourceGroup().id, project.name, projectAdminRoleDefinitionId, testUserOid) scope: project diff --git a/sdk/devcenter/tests.yml b/sdk/devcenter/tests.yml index 77d7e2d7c9b3..fc002c7c41a2 100644 --- a/sdk/devcenter/tests.yml +++ b/sdk/devcenter/tests.yml @@ -5,6 +5,7 @@ extends: parameters: ServiceDirectory: devcenter SDKType: client + DeployTestResources: false CloudConfig: Public: SubscriptionConfiguration: $(sub-config-devcenter-test-resources)