From ee76ef8c57f2ee537502feddebdc2d1277835286 Mon Sep 17 00:00:00 2001 From: Yao Kou Date: Fri, 22 Oct 2021 15:28:51 +0800 Subject: [PATCH] fix issue 24840 (#24843) * fix issue 24840 * fix the sample link * fix the arm template docs link --- .../Azure.ResourceManager.Resources/README.md | 2 +- ...esourceManager.Resources.netstandard2.0.cs | 70 +++++++------- .../samples/README.md | 2 +- .../Sample1_ManagingApplicationDefinitions.md | 2 +- ...deds.md => Sample2_ManagingDeployments.md} | 58 ++++++------ .../{DeploymentExtended.cs => Deployment.cs} | 72 +++++++------- ...dedContainer.cs => DeploymentContainer.cs} | 86 ++++++++--------- ...ymentExtendedData.cs => DeploymentData.cs} | 12 +-- .../Generated/DeploymentOperationContainer.cs | 4 +- .../Extensions/ArmClientExtensions.cs | 10 +- .../Extensions/ManagementGroupExtensions.cs | 10 +- .../Extensions/ResourceGroupExtensions.cs | 10 +- .../Extensions/SubscriptionExtensions.cs | 10 +- .../Generated/Extensions/TenantExtensions.cs | 10 +- ...eploymentCreateOrUpdateAtScopeOperation.cs | 20 ++-- ...ion.cs => DeploymentData.Serialization.cs} | 6 +- ...on.cs => DeploymentInput.Serialization.cs} | 2 +- .../{Deployment.cs => DeploymentInput.cs} | 6 +- .../DeploymentListResult.Serialization.cs | 6 +- .../Generated/Models/DeploymentListResult.cs | 6 +- .../DeploymentsRestOperations.cs | 92 +++++++++--------- .../src/autorest.md | 8 +- .../tests/ResourcesTestBase.cs | 2 +- .../Sample2_ManagingDeploymentExtendeds.cs | 94 ------------------- .../Samples/Sample2_ManagingDeployments.cs | 94 +++++++++++++++++++ ...erTests.cs => DeploymentContainerTests.cs} | 30 +++--- .../DeploymentOperationContainerTests.cs | 14 +-- ...sTests.cs => DeploymentOperationsTests.cs} | 12 +-- .../CreateOrUpdate().json | 0 .../CreateOrUpdate()Async.json | 0 .../Get().json | 0 .../Get()Async.json | 0 .../List().json | 0 .../List()Async.json | 0 .../Delete().json | 0 .../Delete()Async.json | 0 36 files changed, 380 insertions(+), 370 deletions(-) rename sdk/resources/Azure.ResourceManager.Resources/samples/{Sample2_ManagingDeploymentExtendeds.md => Sample2_ManagingDeployments.md} (51%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/{DeploymentExtended.cs => Deployment.cs} (92%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/{DeploymentExtendedContainer.cs => DeploymentContainer.cs} (79%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/{DeploymentExtendedData.cs => DeploymentData.cs} (68%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/{DeploymentExtendedData.Serialization.cs => DeploymentData.Serialization.cs} (90%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/{Deployment.Serialization.cs => DeploymentInput.Serialization.cs} (94%) rename sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/{Deployment.cs => DeploymentInput.cs} (85%) delete mode 100644 sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeploymentExtendeds.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeployments.cs rename sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/{DeploymentExtendedContainerTests.cs => DeploymentContainerTests.cs} (83%) rename sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/{DeploymentExtendedOperationsTests.cs => DeploymentOperationsTests.cs} (65%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/CreateOrUpdate().json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/CreateOrUpdate()Async.json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/Get().json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/Get()Async.json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/List().json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedContainerTests => DeploymentContainerTests}/List()Async.json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedOperationsTests => DeploymentOperationsTests}/Delete().json (100%) rename sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/{DeploymentExtendedOperationsTests => DeploymentOperationsTests}/Delete()Async.json (100%) diff --git a/sdk/resources/Azure.ResourceManager.Resources/README.md b/sdk/resources/Azure.ResourceManager.Resources/README.md index 6ec8f835dece6..f75067d511ae5 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/README.md +++ b/sdk/resources/Azure.ResourceManager.Resources/README.md @@ -9,7 +9,7 @@ This package follows the [new Azure SDK guidelines](https://azure.github.io/azur Install the Azure Resources management library for .NET with [NuGet](https://www.nuget.org/): ```PowerShell -Install-Package Azure.ResourceManager.Resources -Version 1.0.0-preview.2 +Install-Package Azure.ResourceManager.Resources -Version 1.0.0-beta.2 ``` ### Prerequisites diff --git a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs index 4db552fbb8962..9c49331a6d334 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs @@ -110,7 +110,7 @@ public static partial class ArmClientExtensions { public static Azure.ResourceManager.Resources.Application GetApplication(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.ApplicationDefinition GetApplicationDefinition(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Resources.DeploymentExtended GetDeploymentExtended(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Resources.Deployment GetDeployment(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.DeploymentOperation GetDeploymentOperation(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.DeploymentScript GetDeploymentScript(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.JitRequestDefinition GetJitRequestDefinition(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } @@ -118,11 +118,11 @@ public static partial class ArmClientExtensions public static Azure.ResourceManager.Resources.TemplateSpec GetTemplateSpec(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.TemplateSpecVersion GetTemplateSpecVersion(this Azure.ResourceManager.ArmClient armClient, Azure.ResourceManager.ResourceIdentifier id) { throw null; } } - public partial class DeploymentExtended : Azure.ResourceManager.Core.ArmResource + public partial class Deployment : Azure.ResourceManager.Core.ArmResource { public static readonly Azure.ResourceManager.ResourceType ResourceType; - protected DeploymentExtended() { } - public virtual Azure.ResourceManager.Resources.DeploymentExtendedData Data { get { throw null; } } + protected Deployment() { } + public virtual Azure.ResourceManager.Resources.DeploymentData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } public virtual Azure.Response CalculateTemplateHash(object template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -135,35 +135,35 @@ protected DeploymentExtended() { } public virtual System.Threading.Tasks.Task DeleteAsync(bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ExportTemplateAtScope(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ExportTemplateAtScopeAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Collections.Generic.IEnumerable GetAvailableLocations(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAvailableLocationsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public Azure.ResourceManager.Resources.DeploymentOperationContainer GetDeploymentOperations() { throw null; } - public virtual Azure.ResourceManager.Resources.Models.DeploymentValidateAtScopeOperation ValidateAtScope(Azure.ResourceManager.Resources.Models.Deployment parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task ValidateAtScopeAsync(Azure.ResourceManager.Resources.Models.Deployment parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Models.DeploymentValidateAtScopeOperation ValidateAtScope(Azure.ResourceManager.Resources.Models.DeploymentInput parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ValidateAtScopeAsync(Azure.ResourceManager.Resources.Models.DeploymentInput parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Resources.Models.DeploymentWhatIfOperation WhatIf(Azure.ResourceManager.Resources.Models.DeploymentWhatIfProperties properties, string location = null, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task WhatIfAsync(Azure.ResourceManager.Resources.Models.DeploymentWhatIfProperties properties, string location = null, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class DeploymentExtendedContainer : Azure.ResourceManager.Core.ArmContainer + public partial class DeploymentContainer : Azure.ResourceManager.Core.ArmContainer { - protected DeploymentExtendedContainer() { } + protected DeploymentContainer() { } protected override Azure.ResourceManager.ResourceType ValidResourceType { get { throw null; } } public virtual Azure.Response CheckIfExists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CheckIfExistsAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.Resources.Models.DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string deploymentName, Azure.ResourceManager.Resources.Models.Deployment parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string deploymentName, Azure.ResourceManager.Resources.Models.Deployment parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetIfExists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Models.DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string deploymentName, Azure.ResourceManager.Resources.Models.DeploymentInput parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string deploymentName, Azure.ResourceManager.Resources.Models.DeploymentInput parameters, bool waitForCompletion = true, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetIfExists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected override void ValidateResourceType(Azure.ResourceManager.ResourceIdentifier identifier) { } } - public partial class DeploymentExtendedData : Azure.ResourceManager.Models.Resource + public partial class DeploymentData : Azure.ResourceManager.Models.Resource { - internal DeploymentExtendedData() { } + internal DeploymentData() { } public string Location { get { throw null; } } public Azure.ResourceManager.Resources.Models.DeploymentPropertiesExtended Properties { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } @@ -295,13 +295,13 @@ public JitRequestDefinitionData(Azure.ResourceManager.Resources.Models.Location } public static partial class ManagementGroupExtensions { - public static Azure.ResourceManager.Resources.DeploymentExtendedContainer GetDeploymentExtendeds(this Azure.ResourceManager.Management.ManagementGroup managementGroup) { throw null; } + public static Azure.ResourceManager.Resources.DeploymentContainer GetDeployments(this Azure.ResourceManager.Management.ManagementGroup managementGroup) { throw null; } } public static partial class ResourceGroupExtensions { public static Azure.ResourceManager.Resources.ApplicationDefinitionContainer GetApplicationDefinitions(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } public static Azure.ResourceManager.Resources.ApplicationContainer GetApplications(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } - public static Azure.ResourceManager.Resources.DeploymentExtendedContainer GetDeploymentExtendeds(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } + public static Azure.ResourceManager.Resources.DeploymentContainer GetDeployments(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } public static Azure.ResourceManager.Resources.DeploymentScriptContainer GetDeploymentScripts(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } public static Azure.ResourceManager.Resources.JitRequestDefinitionContainer GetJitRequestDefinitions(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } public static Azure.ResourceManager.Resources.TemplateSpecContainer GetTemplateSpecs(this Azure.ResourceManager.Resources.ResourceGroup resourceGroup) { throw null; } @@ -332,7 +332,7 @@ public static partial class SubscriptionExtensions public static Azure.AsyncPageable GetApplicationByNameAsync(this Azure.ResourceManager.Resources.Subscription subscription, string filter, string expand, int? top, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetApplications(this Azure.ResourceManager.Resources.Subscription subscription, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetApplicationsAsync(this Azure.ResourceManager.Resources.Subscription subscription, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.Resources.DeploymentExtendedContainer GetDeploymentExtendeds(this Azure.ResourceManager.Resources.Subscription subscription) { throw null; } + public static Azure.ResourceManager.Resources.DeploymentContainer GetDeployments(this Azure.ResourceManager.Resources.Subscription subscription) { throw null; } public static Azure.Pageable GetDeploymentScriptByName(this Azure.ResourceManager.Resources.Subscription subscription, string filter, string expand, int? top, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetDeploymentScriptByNameAsync(this Azure.ResourceManager.Resources.Subscription subscription, string filter, string expand, int? top, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetDeploymentScripts(this Azure.ResourceManager.Resources.Subscription subscription, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -434,7 +434,7 @@ public TemplateSpecVersionData(string location) { } } public static partial class TenantExtensions { - public static Azure.ResourceManager.Resources.DeploymentExtended GetDeploymentExtended(this Azure.ResourceManager.Resources.Tenant tenant, Azure.ResourceManager.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Resources.Deployment GetDeployment(this Azure.ResourceManager.Resources.Tenant tenant, Azure.ResourceManager.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Resources.DeploymentOperation GetDeploymentOperation(this Azure.ResourceManager.Resources.Tenant tenant, Azure.ResourceManager.ResourceIdentifier id) { throw null; } } } @@ -807,25 +807,18 @@ internal Dependency() { } public string ResourceName { get { throw null; } } public string ResourceType { get { throw null; } } } - public partial class Deployment - { - public Deployment(Azure.ResourceManager.Resources.Models.DeploymentProperties properties) { } - public string Location { get { throw null; } set { } } - public Azure.ResourceManager.Resources.Models.DeploymentProperties Properties { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - } - public partial class DeploymentCreateOrUpdateAtScopeOperation : Azure.Operation + public partial class DeploymentCreateOrUpdateAtScopeOperation : Azure.Operation { protected DeploymentCreateOrUpdateAtScopeOperation() { } public override bool HasCompleted { get { throw null; } } public override bool HasValue { get { throw null; } } public override string Id { get { throw null; } } - public override Azure.ResourceManager.Resources.DeploymentExtended Value { get { throw null; } } + public override Azure.ResourceManager.Resources.Deployment Value { get { throw null; } } public override Azure.Response GetRawResponse() { throw null; } public override Azure.Response UpdateStatus(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask UpdateStatusAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class DeploymentDeleteAtScopeOperation : Azure.Operation { @@ -843,6 +836,13 @@ public partial class DeploymentExportResult internal DeploymentExportResult() { } public object Template { get { throw null; } } } + public partial class DeploymentInput + { + public DeploymentInput(Azure.ResourceManager.Resources.Models.DeploymentProperties properties) { } + public string Location { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.DeploymentProperties Properties { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DeploymentMode : System.IEquatable { diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/README.md b/sdk/resources/Azure.ResourceManager.Resources/samples/README.md index caa1db930241a..c9c0bb6822d00 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/README.md +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/README.md @@ -12,4 +12,4 @@ description: Samples for the Azure.ResourceManager.Resources client library # Azure.ResourceManager.Resources Samples - [Managing Application Definitions](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md) -- [Managing Deployment Extended](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md) +- [Managing Deployments](https://github.com/Yao725/azure-sdk-for-net/blob/fix-issue-24840/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md) diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md b/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md index 2596043c80dd7..7b2ae34638a3c 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Sample1_ManagingApplicationDefinitions.md @@ -74,4 +74,4 @@ await applicationDefinition.DeleteAsync(); ## Next steps -Take a look at the [Managing Deployment Extended](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md) samples. +Take a look at the [Managing Deployments](https://github.com/Yao725/azure-sdk-for-net/blob/fix-issue-24840/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md) samples. diff --git a/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md b/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md similarity index 51% rename from sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md rename to sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md index 0f2bb5dafd4d6..59671170336d5 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeploymentExtendeds.md +++ b/sdk/resources/Azure.ResourceManager.Resources/samples/Sample2_ManagingDeployments.md @@ -1,9 +1,9 @@ -# Example: Managing the deployment extendeds +# Example: Managing the deployments >Note: Before getting started with the samples, go through the [prerequisites](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/resourcemanager/Azure.ResourceManager#prerequisites). Namespaces for this example: -```C# Snippet:Manage_DeploymentExtendeds_Namespaces +```C# Snippet:Manage_Deployments_Namespaces using System; using System.Threading.Tasks; using Azure.Identity; @@ -30,16 +30,16 @@ ResourceGroupCreateOrUpdateOperation lro = await rgContainer.CreateOrUpdateAsync ResourceGroup resourceGroup = lro.Value; ``` -Now that we have the resource group created, we can manage the deployment extendeds inside this resource group. +Now that we have the resource group created, we can manage the deployments inside this resource group. -***Create a deployment extendeds*** +***Create a deployment*** -```C# Snippet:Managing_DeploymentExtendeds_CreateADeploymentExtended -// First we need to get the deployment extended container from the resource group -DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); +```C# Snippet:Managing_Deployments_CreateADeployment +// First we need to get the deployment container from the resource group +DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); // Use the same location as the resource group -string deploymentExtendedName = "myDeployment"; -var input = new Deployment(new DeploymentProperties(DeploymentMode.Incremental) +string deploymentName = "myDeployment"; +var input = new DeploymentInput(new DeploymentProperties(DeploymentMode.Incremental) { TemplateLink = new TemplateLink() { @@ -54,30 +54,34 @@ var input = new Deployment(new DeploymentProperties(DeploymentMode.Incremental) } } }); -DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentExtendedContainer.CreateOrUpdateAsync(deploymentExtendedName, input); -DeploymentExtended deploymentExtended = lro.Value; +DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentContainer.CreateOrUpdateAsync(deploymentName, input); +Deployment deployment = lro.Value; ``` -***List all deployment extendeds*** +***List all deployments*** -```C# Snippet:Managing_DeploymentExtendeds_ListAllDeploymentExtendeds -// First we need to get the deployment extended container from the resource group -DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); -// With GetAllAsync(), we can get a list of the deployment extendeds in the container -AsyncPageable response = deploymentExtendedContainer.GetAllAsync(); -await foreach (DeploymentExtended deploymentExtended in response) +```C# Snippet:Managing_Deployments_ListAllDeployments +// First we need to get the deployment container from the resource group +DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); +// With GetAllAsync(), we can get a list of the deployments in the container +AsyncPageable response = deploymentContainer.GetAllAsync(); +await foreach (Deployment deployment in response) { - Console.WriteLine(deploymentExtended.Data.Name); + Console.WriteLine(deployment.Data.Name); } ``` -***Delete a deployment extendeds*** +***Delete a deployment*** -```C# Snippet:Managing_DeploymentExtendeds_DeleteADeploymentExtended -// First we need to get the deployment extended container from the resource group -DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); -// Now we can get the deployment extended with GetAsync() -DeploymentExtended deploymentExtended = await deploymentExtendedContainer.GetAsync("myDeployment"); -// With DeleteAsync(), we can delete the deployment extended -await deploymentExtended.DeleteAsync(); +```C# Snippet:Managing_Deployments_DeleteADeployment +// First we need to get the deployment container from the resource group +DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); +// Now we can get the deployment with GetAsync() +Deployment deployment = await deploymentContainer.GetAsync("myDeployment"); +// With DeleteAsync(), we can delete the deployment +await deployment.DeleteAsync(); ``` + + +## Learn more +Take a look at the [ARM template documentation](https://docs.microsoft.com/azure/azure-resource-manager/templates/). \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtended.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Deployment.cs similarity index 92% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtended.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/Deployment.cs index 4f9c1086ca50a..cb21f4f8f20ed 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtended.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Deployment.cs @@ -19,22 +19,22 @@ namespace Azure.ResourceManager.Resources { - /// A Class representing a DeploymentExtended along with the instance operations that can be performed on it. - public partial class DeploymentExtended : ArmResource + /// A Class representing a Deployment along with the instance operations that can be performed on it. + public partial class Deployment : ArmResource { private readonly ClientDiagnostics _clientDiagnostics; private readonly DeploymentsRestOperations _restClient; - private readonly DeploymentExtendedData _data; + private readonly DeploymentData _data; - /// Initializes a new instance of the class for mocking. - protected DeploymentExtended() + /// Initializes a new instance of the class for mocking. + protected Deployment() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal DeploymentExtended(ArmResource options, DeploymentExtendedData resource) : base(options, resource.Id) + internal Deployment(ArmResource options, DeploymentData resource) : base(options, resource.Id) { HasData = true; _data = resource; @@ -42,22 +42,22 @@ internal DeploymentExtended(ArmResource options, DeploymentExtendedData resource _restClient = new DeploymentsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal DeploymentExtended(ArmResource options, ResourceIdentifier id) : base(options, id) + internal Deployment(ArmResource options, ResourceIdentifier id) : base(options, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new DeploymentsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client options to build client context. /// The credential to build client context. /// The uri to build client context. /// The pipeline to build client context. /// The identifier of the resource that is the target of operations. - internal DeploymentExtended(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) + internal Deployment(ArmClientOptions clientOptions, TokenCredential credential, Uri uri, HttpPipeline pipeline, ResourceIdentifier id) : base(clientOptions, credential, uri, pipeline, id) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new DeploymentsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); @@ -74,7 +74,7 @@ internal DeploymentExtended(ArmClientOptions clientOptions, TokenCredential cred /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual DeploymentExtendedData Data + public virtual DeploymentData Data { get { @@ -86,16 +86,16 @@ public virtual DeploymentExtendedData Data /// Gets a deployment. /// The cancellation token to use. - public async virtual Task> GetAsync(CancellationToken cancellationToken = default) + public async virtual Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.Get"); + using var scope = _clientDiagnostics.CreateScope("Deployment.Get"); scope.Start(); try { var response = await _restClient.GetAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new DeploymentExtended(this, response.Value), response.GetRawResponse()); + return Response.FromValue(new Deployment(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -106,16 +106,16 @@ public async virtual Task> GetAsync(CancellationTok /// Gets a deployment. /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.Get"); + using var scope = _clientDiagnostics.CreateScope("Deployment.Get"); scope.Start(); try { var response = _restClient.GetAtScope(Id.Parent, Id.Name, cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new DeploymentExtended(this, response.Value), response.GetRawResponse()); + return Response.FromValue(new Deployment(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -145,7 +145,7 @@ public virtual IEnumerable GetAvailableLocations(CancellationToken can /// The cancellation token to use. public async virtual Task DeleteAsync(bool waitForCompletion = true, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.Delete"); + using var scope = _clientDiagnostics.CreateScope("Deployment.Delete"); scope.Start(); try { @@ -167,7 +167,7 @@ public async virtual Task DeleteAsync(bool wai /// The cancellation token to use. public virtual DeploymentDeleteAtScopeOperation Delete(bool waitForCompletion = true, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.Delete"); + using var scope = _clientDiagnostics.CreateScope("Deployment.Delete"); scope.Start(); try { @@ -187,7 +187,7 @@ public virtual DeploymentDeleteAtScopeOperation Delete(bool waitForCompletion = /// The cancellation token to use. public virtual async Task CheckExistenceAtScopeAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CheckExistenceAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CheckExistenceAtScope"); scope.Start(); try { @@ -205,7 +205,7 @@ public virtual async Task CheckExistenceAtScopeAsync(CancellationToken /// The cancellation token to use. public virtual Response CheckExistenceAtScope(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CheckExistenceAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CheckExistenceAtScope"); scope.Start(); try { @@ -223,7 +223,7 @@ public virtual Response CheckExistenceAtScope(CancellationToken cancellationToke /// The cancellation token to use. public virtual async Task CancelAtScopeAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CancelAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CancelAtScope"); scope.Start(); try { @@ -241,7 +241,7 @@ public virtual async Task CancelAtScopeAsync(CancellationToken cancell /// The cancellation token to use. public virtual Response CancelAtScope(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CancelAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CancelAtScope"); scope.Start(); try { @@ -259,7 +259,7 @@ public virtual Response CancelAtScope(CancellationToken cancellationToken = defa /// The cancellation token to use. public virtual async Task> ExportTemplateAtScopeAsync(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.ExportTemplateAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.ExportTemplateAtScope"); scope.Start(); try { @@ -277,7 +277,7 @@ public virtual async Task> ExportTemplateAtScop /// The cancellation token to use. public virtual Response ExportTemplateAtScope(CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.ExportTemplateAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.ExportTemplateAtScope"); scope.Start(); try { @@ -302,7 +302,7 @@ public virtual async Task> CalculateTemplateHashAsy throw new ArgumentNullException(nameof(template)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CalculateTemplateHash"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CalculateTemplateHash"); scope.Start(); try { @@ -327,7 +327,7 @@ public virtual Response CalculateTemplateHash(object templat throw new ArgumentNullException(nameof(template)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.CalculateTemplateHash"); + using var scope = _clientDiagnostics.CreateScope("Deployment.CalculateTemplateHash"); scope.Start(); try { @@ -346,14 +346,14 @@ public virtual Response CalculateTemplateHash(object templat /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public async virtual Task ValidateAtScopeAsync(Deployment parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task ValidateAtScopeAsync(DeploymentInput parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.ValidateAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.ValidateAtScope"); scope.Start(); try { @@ -375,14 +375,14 @@ public async virtual Task ValidateAtScopeAsy /// Waits for the completion of the long running operations. /// The cancellation token to use. /// is null. - public virtual DeploymentValidateAtScopeOperation ValidateAtScope(Deployment parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual DeploymentValidateAtScopeOperation ValidateAtScope(DeploymentInput parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.ValidateAtScope"); + using var scope = _clientDiagnostics.CreateScope("Deployment.ValidateAtScope"); scope.Start(); try { @@ -412,7 +412,7 @@ public async virtual Task WhatIfAsync(DeploymentWhatI throw new ArgumentNullException(nameof(properties)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.WhatIf"); + using var scope = _clientDiagnostics.CreateScope("Deployment.WhatIf"); scope.Start(); try { @@ -477,7 +477,7 @@ public virtual DeploymentWhatIfOperation WhatIf(DeploymentWhatIfProperties prope throw new ArgumentNullException(nameof(properties)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtended.WhatIf"); + using var scope = _clientDiagnostics.CreateScope("Deployment.WhatIf"); scope.Start(); try { @@ -529,8 +529,8 @@ public virtual DeploymentWhatIfOperation WhatIf(DeploymentWhatIfProperties prope } } - /// Gets a list of DeploymentOperations in the DeploymentExtended. - /// An object representing collection of DeploymentOperations and their operations over a DeploymentExtended. + /// Gets a list of DeploymentOperations in the Deployment. + /// An object representing collection of DeploymentOperations and their operations over a Deployment. public DeploymentOperationContainer GetDeploymentOperations() { return new DeploymentOperationContainer(this); diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedContainer.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentContainer.cs similarity index 79% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedContainer.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentContainer.cs index 1e2b6541a6313..cf5da962b8d7b 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedContainer.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentContainer.cs @@ -18,20 +18,20 @@ namespace Azure.ResourceManager.Resources { - /// A class representing collection of DeploymentExtended and their operations over a Tenant. - public partial class DeploymentExtendedContainer : ArmContainer + /// A class representing collection of Deployment and their operations over a Tenant. + public partial class DeploymentContainer : ArmContainer { private readonly ClientDiagnostics _clientDiagnostics; private readonly DeploymentsRestOperations _restClient; - /// Initializes a new instance of the class for mocking. - protected DeploymentExtendedContainer() + /// Initializes a new instance of the class for mocking. + protected DeploymentContainer() { } - /// Initializes a new instance of DeploymentExtendedContainer class. + /// Initializes a new instance of DeploymentContainer class. /// The resource representing the parent resource. - internal DeploymentExtendedContainer(ArmResource parent) : base(parent) + internal DeploymentContainer(ArmResource parent) : base(parent) { _clientDiagnostics = new ClientDiagnostics(ClientOptions); _restClient = new DeploymentsRestOperations(_clientDiagnostics, Pipeline, ClientOptions, BaseUri); @@ -54,7 +54,7 @@ protected override void ValidateResourceType(ResourceIdentifier identifier) /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public virtual DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string deploymentName, Deployment parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public virtual DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string deploymentName, DeploymentInput parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (deploymentName == null) { @@ -65,7 +65,7 @@ public virtual DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string de throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.CreateOrUpdate"); scope.Start(); try { @@ -88,7 +88,7 @@ public virtual DeploymentCreateOrUpdateAtScopeOperation CreateOrUpdate(string de /// Waits for the completion of the long running operations. /// The cancellation token to use. /// or is null. - public async virtual Task CreateOrUpdateAsync(string deploymentName, Deployment parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) + public async virtual Task CreateOrUpdateAsync(string deploymentName, DeploymentInput parameters, bool waitForCompletion = true, CancellationToken cancellationToken = default) { if (deploymentName == null) { @@ -99,7 +99,7 @@ public async virtual Task CreateOrUpda throw new ArgumentNullException(nameof(parameters)); } - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.CreateOrUpdate"); scope.Start(); try { @@ -119,9 +119,9 @@ public async virtual Task CreateOrUpda /// Gets details for this resource from the service. /// The name of the deployment. /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response Get(string deploymentName, CancellationToken cancellationToken = default) + public virtual Response Get(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.Get"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.Get"); scope.Start(); try { @@ -133,7 +133,7 @@ public virtual Response Get(string deploymentName, Cancellat var response = _restClient.GetAtScope(Id, deploymentName, cancellationToken: cancellationToken); if (response.Value == null) throw _clientDiagnostics.CreateRequestFailedException(response.GetRawResponse()); - return Response.FromValue(new DeploymentExtended(Parent, response.Value), response.GetRawResponse()); + return Response.FromValue(new Deployment(Parent, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -145,9 +145,9 @@ public virtual Response Get(string deploymentName, Cancellat /// Gets details for this resource from the service. /// The name of the deployment. /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetAsync(string deploymentName, CancellationToken cancellationToken = default) + public async virtual Task> GetAsync(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.Get"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.Get"); scope.Start(); try { @@ -159,7 +159,7 @@ public async virtual Task> GetAsync(string deployme var response = await _restClient.GetAtScopeAsync(Id, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(response.GetRawResponse()).ConfigureAwait(false); - return Response.FromValue(new DeploymentExtended(Parent, response.Value), response.GetRawResponse()); + return Response.FromValue(new Deployment(Parent, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -171,9 +171,9 @@ public async virtual Task> GetAsync(string deployme /// Tries to get details for this resource from the service. /// The name of the deployment. /// A token to allow the caller to cancel the call to the service. The default value is . - public virtual Response GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + public virtual Response GetIfExists(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetIfExists"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetIfExists"); scope.Start(); try { @@ -184,8 +184,8 @@ public virtual Response GetIfExists(string deploymentName, C var response = _restClient.GetAtScope(Id, deploymentName, cancellationToken: cancellationToken); return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new DeploymentExtended(this, response.Value), response.GetRawResponse()); + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Deployment(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -197,9 +197,9 @@ public virtual Response GetIfExists(string deploymentName, C /// Tries to get details for this resource from the service. /// The name of the deployment. /// A token to allow the caller to cancel the call to the service. The default value is . - public async virtual Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + public async virtual Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetIfExists"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetIfExists"); scope.Start(); try { @@ -210,8 +210,8 @@ public async virtual Task> GetIfExistsAsync(string var response = await _restClient.GetAtScopeAsync(Id, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); return response.Value == null - ? Response.FromValue(null, response.GetRawResponse()) - : Response.FromValue(new DeploymentExtended(this, response.Value), response.GetRawResponse()); + ? Response.FromValue(null, response.GetRawResponse()) + : Response.FromValue(new Deployment(this, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -225,7 +225,7 @@ public async virtual Task> GetIfExistsAsync(string /// A token to allow the caller to cancel the call to the service. The default value is . public virtual Response CheckIfExists(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.CheckIfExists"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.CheckIfExists"); scope.Start(); try { @@ -249,7 +249,7 @@ public virtual Response CheckIfExists(string deploymentName, CancellationT /// A token to allow the caller to cancel the call to the service. The default value is . public async virtual Task> CheckIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.CheckIfExists"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.CheckIfExists"); scope.Start(); try { @@ -272,17 +272,17 @@ public async virtual Task> CheckIfExistsAsync(string deploymentNa /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. /// The number of results to get. If null is passed, returns all deployments. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetAll"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetAll"); scope.Start(); try { var response = _restClient.GetAtScope(Id, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new DeploymentExtended(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + return Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -290,14 +290,14 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - Page NextPageFunc(string nextLink, int? pageSizeHint) + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetAll"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetAll"); scope.Start(); try { var response = _restClient.GetAtScopeNextPage(nextLink, Id, filter, top, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new DeploymentExtended(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + return Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -312,17 +312,17 @@ Page NextPageFunc(string nextLink, int? pageSizeHint) /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. /// The number of results to get. If null is passed, returns all deployments. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetAll"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetAll"); scope.Start(); try { var response = await _restClient.GetAtScopeAsync(Id, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new DeploymentExtended(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + return Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -330,14 +330,14 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - async Task> NextPageFunc(string nextLink, int? pageSizeHint) + async Task> NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _clientDiagnostics.CreateScope("DeploymentExtendedContainer.GetAll"); + using var scope = _clientDiagnostics.CreateScope("DeploymentContainer.GetAll"); scope.Start(); try { var response = await _restClient.GetAtScopeNextPageAsync(nextLink, Id, filter, top, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new DeploymentExtended(Parent, value)), response.Value.NextLink, response.GetRawResponse()); + return Page.FromValues(response.Value.Value.Select(value => new Deployment(Parent, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -349,6 +349,6 @@ async Task> NextPageFunc(string nextLink, int? pageSize } // Builders. - // public ArmBuilder Construct() { } + // public ArmBuilder Construct() { } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedData.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentData.cs similarity index 68% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedData.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentData.cs index b7fd67a1cd825..4dbc29de6cc14 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentExtendedData.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentData.cs @@ -13,23 +13,23 @@ namespace Azure.ResourceManager.Resources { - /// A class representing the DeploymentExtended data model. - public partial class DeploymentExtendedData : Resource + /// A class representing the Deployment data model. + public partial class DeploymentData : Resource { - /// Initializes a new instance of DeploymentExtendedData. - internal DeploymentExtendedData() + /// Initializes a new instance of DeploymentData. + internal DeploymentData() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of DeploymentExtendedData. + /// Initializes a new instance of DeploymentData. /// The id. /// The name. /// The type. /// the location of the deployment. /// Deployment properties. /// Deployment tags. - internal DeploymentExtendedData(ResourceIdentifier id, string name, ResourceType type, string location, DeploymentPropertiesExtended properties, IReadOnlyDictionary tags) : base(id, name, type) + internal DeploymentData(ResourceIdentifier id, string name, ResourceType type, string location, DeploymentPropertiesExtended properties, IReadOnlyDictionary tags) : base(id, name, type) { Location = location; Properties = properties; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationContainer.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationContainer.cs index 9026e23c63b5e..c7a8be03d153e 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationContainer.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationContainer.cs @@ -17,7 +17,7 @@ namespace Azure.ResourceManager.Resources { - /// A class representing collection of DeploymentOperation and their operations over a DeploymentExtended. + /// A class representing collection of DeploymentOperation and their operations over a Deployment. public partial class DeploymentOperationContainer : ArmContainer { private readonly ClientDiagnostics _clientDiagnostics; @@ -37,7 +37,7 @@ internal DeploymentOperationContainer(ArmResource parent) : base(parent) } /// Gets the valid resource type for this object. - protected override ResourceType ValidResourceType => DeploymentExtended.ResourceType; + protected override ResourceType ValidResourceType => Deployment.ResourceType; // Container level operations. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ArmClientExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ArmClientExtensions.cs index 8aab4060d6eac..0acda47f5a51c 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ArmClientExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ArmClientExtensions.cs @@ -12,14 +12,14 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to ArmClient. public static partial class ArmClientExtensions { - #region DeploymentExtended - /// Gets an object representing a DeploymentExtended along with the instance operations that can be performed on it but with no data. + #region Deployment + /// Gets an object representing a Deployment along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static DeploymentExtended GetDeploymentExtended(this ArmClient armClient, ResourceIdentifier id) + /// Returns a object. + public static Deployment GetDeployment(this ArmClient armClient, ResourceIdentifier id) { - return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new DeploymentExtended(clientOptions, credential, uri, pipeline, id)); + return armClient.UseClientContext((uri, credential, clientOptions, pipeline) => new Deployment(clientOptions, credential, uri, pipeline, id)); } #endregion diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupExtensions.cs index 7ee196f3b1663..3addb752a19b8 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupExtensions.cs @@ -12,13 +12,13 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to ManagementGroup. public static partial class ManagementGroupExtensions { - #region DeploymentExtended - /// Gets an object representing a DeploymentExtendedContainer along with the instance operations that can be performed on it. + #region Deployment + /// Gets an object representing a DeploymentContainer along with the instance operations that can be performed on it. /// The instance the method will execute against. - /// Returns a object. - public static DeploymentExtendedContainer GetDeploymentExtendeds(this ManagementGroup managementGroup) + /// Returns a object. + public static DeploymentContainer GetDeployments(this ManagementGroup managementGroup) { - return new DeploymentExtendedContainer(managementGroup); + return new DeploymentContainer(managementGroup); } #endregion } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupExtensions.cs index 24568b0b41aa0..90c28e0961952 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ResourceGroupExtensions.cs @@ -10,13 +10,13 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to ResourceGroup. public static partial class ResourceGroupExtensions { - #region DeploymentExtended - /// Gets an object representing a DeploymentExtendedContainer along with the instance operations that can be performed on it. + #region Deployment + /// Gets an object representing a DeploymentContainer along with the instance operations that can be performed on it. /// The instance the method will execute against. - /// Returns a object. - public static DeploymentExtendedContainer GetDeploymentExtendeds(this ResourceGroup resourceGroup) + /// Returns a object. + public static DeploymentContainer GetDeployments(this ResourceGroup resourceGroup) { - return new DeploymentExtendedContainer(resourceGroup); + return new DeploymentContainer(resourceGroup); } #endregion diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionExtensions.cs index 446c14a0d4112..b74b3675d35c1 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/SubscriptionExtensions.cs @@ -22,13 +22,13 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to Subscription. public static partial class SubscriptionExtensions { - #region DeploymentExtended - /// Gets an object representing a DeploymentExtendedContainer along with the instance operations that can be performed on it. + #region Deployment + /// Gets an object representing a DeploymentContainer along with the instance operations that can be performed on it. /// The instance the method will execute against. - /// Returns a object. - public static DeploymentExtendedContainer GetDeploymentExtendeds(this Subscription subscription) + /// Returns a object. + public static DeploymentContainer GetDeployments(this Subscription subscription) { - return new DeploymentExtendedContainer(subscription); + return new DeploymentContainer(subscription); } #endregion diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantExtensions.cs index 30c55b31becdf..d0f3b829e1e83 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantExtensions.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/TenantExtensions.cs @@ -12,14 +12,14 @@ namespace Azure.ResourceManager.Resources /// A class to add extension methods to Tenant. public static partial class TenantExtensions { - #region DeploymentExtended - /// Gets an object representing a DeploymentExtended along with the instance operations that can be performed on it but with no data. + #region Deployment + /// Gets an object representing a Deployment along with the instance operations that can be performed on it but with no data. /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static DeploymentExtended GetDeploymentExtended(this Tenant tenant, ResourceIdentifier id) + /// Returns a object. + public static Deployment GetDeployment(this Tenant tenant, ResourceIdentifier id) { - return new DeploymentExtended(tenant, id); + return new Deployment(tenant, id); } #endregion diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/LongRunningOperation/DeploymentCreateOrUpdateAtScopeOperation.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/LongRunningOperation/DeploymentCreateOrUpdateAtScopeOperation.cs index 2afca61208979..f92895aef6392 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/LongRunningOperation/DeploymentCreateOrUpdateAtScopeOperation.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/LongRunningOperation/DeploymentCreateOrUpdateAtScopeOperation.cs @@ -18,9 +18,9 @@ namespace Azure.ResourceManager.Resources.Models { /// You can provide the template and parameters directly in the request or link to JSON files. - public partial class DeploymentCreateOrUpdateAtScopeOperation : Operation, IOperationSource + public partial class DeploymentCreateOrUpdateAtScopeOperation : Operation, IOperationSource { - private readonly OperationInternals _operation; + private readonly OperationInternals _operation; private readonly ArmResource _operationBase; @@ -31,7 +31,7 @@ protected DeploymentCreateOrUpdateAtScopeOperation() internal DeploymentCreateOrUpdateAtScopeOperation(ArmResource operationsBase, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response) { - _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentCreateOrUpdateAtScopeOperation"); + _operation = new OperationInternals(this, clientDiagnostics, pipeline, request, response, OperationFinalStateVia.Location, "DeploymentCreateOrUpdateAtScopeOperation"); _operationBase = operationsBase; } @@ -39,7 +39,7 @@ internal DeploymentCreateOrUpdateAtScopeOperation(ArmResource operationsBase, Cl public override string Id => _operation.Id; /// - public override DeploymentExtended Value => _operation.Value; + public override Deployment Value => _operation.Value; /// public override bool HasCompleted => _operation.HasCompleted; @@ -57,21 +57,21 @@ internal DeploymentCreateOrUpdateAtScopeOperation(ArmResource operationsBase, Cl public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); /// - public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); - DeploymentExtended IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + Deployment IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream); - return new DeploymentExtended(_operationBase, DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement)); + return new Deployment(_operationBase, DeploymentData.DeserializeDeploymentData(document.RootElement)); } - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return new DeploymentExtended(_operationBase, DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement)); + return new Deployment(_operationBase, DeploymentData.DeserializeDeploymentData(document.RootElement)); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentExtendedData.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentData.Serialization.cs similarity index 90% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentExtendedData.Serialization.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentData.Serialization.cs index 12d6e9dfc4861..1eac4851ad0a1 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentExtendedData.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentData.Serialization.cs @@ -13,9 +13,9 @@ namespace Azure.ResourceManager.Resources { - public partial class DeploymentExtendedData + public partial class DeploymentData { - internal static DeploymentExtendedData DeserializeDeploymentExtendedData(JsonElement element) + internal static DeploymentData DeserializeDeploymentData(JsonElement element) { Optional location = default; Optional properties = default; @@ -71,7 +71,7 @@ internal static DeploymentExtendedData DeserializeDeploymentExtendedData(JsonEle continue; } } - return new DeploymentExtendedData(id, name, type, location.Value, properties.Value, Optional.ToDictionary(tags)); + return new DeploymentData(id, name, type, location.Value, properties.Value, Optional.ToDictionary(tags)); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.Serialization.cs similarity index 94% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.Serialization.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.Serialization.cs index 7fe631f071584..3da5225d0b019 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources.Models { - public partial class Deployment : IUtf8JsonSerializable + public partial class DeploymentInput : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.cs similarity index 85% rename from sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.cs rename to sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.cs index 961ea4073aec2..a8a56dca913bf 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Deployment.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentInput.cs @@ -12,12 +12,12 @@ namespace Azure.ResourceManager.Resources.Models { /// Deployment operation parameters. - public partial class Deployment + public partial class DeploymentInput { - /// Initializes a new instance of Deployment. + /// Initializes a new instance of DeploymentInput. /// The deployment properties. /// is null. - public Deployment(DeploymentProperties properties) + public DeploymentInput(DeploymentProperties properties) { if (properties == null) { diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs index e237b2bb8e83f..71812b0c5fef4 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.Serialization.cs @@ -16,7 +16,7 @@ internal partial class DeploymentListResult { internal static DeploymentListResult DeserializeDeploymentListResult(JsonElement element) { - Optional> value = default; + Optional> value = default; Optional nextLink = default; foreach (var property in element.EnumerateObject()) { @@ -27,10 +27,10 @@ internal static DeploymentListResult DeserializeDeploymentListResult(JsonElement property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(DeploymentExtendedData.DeserializeDeploymentExtendedData(item)); + array.Add(DeploymentData.DeserializeDeploymentData(item)); } value = array; continue; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.cs index 5a6dfe7d389b8..ed88fc0e02905 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentListResult.cs @@ -17,20 +17,20 @@ internal partial class DeploymentListResult /// Initializes a new instance of DeploymentListResult. internal DeploymentListResult() { - Value = new ChangeTrackingList(); + Value = new ChangeTrackingList(); } /// Initializes a new instance of DeploymentListResult. /// An array of deployments. /// The URL to use for getting the next set of results. - internal DeploymentListResult(IReadOnlyList value, string nextLink) + internal DeploymentListResult(IReadOnlyList value, string nextLink) { Value = value; NextLink = nextLink; } /// An array of deployments. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The URL to use for getting the next set of results. public string NextLink { get; } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/RestOperations/DeploymentsRestOperations.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/RestOperations/DeploymentsRestOperations.cs index 1243675749af3..46042167f5d69 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/RestOperations/DeploymentsRestOperations.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -185,7 +185,7 @@ public Response CheckExistenceAtScope(string scope, string deploymentName, Cance } } - internal Azure.Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, string deploymentName, Deployment parameters) + internal Azure.Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, string deploymentName, DeploymentInput parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -213,7 +213,7 @@ internal Azure.Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, /// Additional parameters supplied to the operation. /// The cancellation token to use. /// , , or is null. - public async Task CreateOrUpdateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + public async Task CreateOrUpdateAtScopeAsync(string scope, string deploymentName, DeploymentInput parameters, CancellationToken cancellationToken = default) { if (scope == null) { @@ -246,7 +246,7 @@ public async Task CreateOrUpdateAtScopeAsync(string scope, string depl /// Additional parameters supplied to the operation. /// The cancellation token to use. /// , , or is null. - public Response CreateOrUpdateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + public Response CreateOrUpdateAtScope(string scope, string deploymentName, DeploymentInput parameters, CancellationToken cancellationToken = default) { if (scope == null) { @@ -296,7 +296,7 @@ internal Azure.Core.HttpMessage CreateGetAtScopeRequest(string scope, string dep /// The name of the deployment. /// The cancellation token to use. /// or is null. - public async Task> GetAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + public async Task> GetAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) { if (scope == null) { @@ -313,13 +313,13 @@ public async Task> GetAtScopeAsync(string scope { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -330,7 +330,7 @@ public async Task> GetAtScopeAsync(string scope /// The name of the deployment. /// The cancellation token to use. /// or is null. - public Response GetAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + public Response GetAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) { if (scope == null) { @@ -347,13 +347,13 @@ public Response GetAtScope(string scope, string deployme { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -432,7 +432,7 @@ public Response CancelAtScope(string scope, string deploymentName, CancellationT } } - internal Azure.Core.HttpMessage CreateValidateAtScopeRequest(string scope, string deploymentName, Deployment parameters) + internal Azure.Core.HttpMessage CreateValidateAtScopeRequest(string scope, string deploymentName, DeploymentInput parameters) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -461,7 +461,7 @@ internal Azure.Core.HttpMessage CreateValidateAtScopeRequest(string scope, strin /// Parameters to validate. /// The cancellation token to use. /// , , or is null. - public async Task ValidateAtScopeAsync(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + public async Task ValidateAtScopeAsync(string scope, string deploymentName, DeploymentInput parameters, CancellationToken cancellationToken = default) { if (scope == null) { @@ -495,7 +495,7 @@ public async Task ValidateAtScopeAsync(string scope, string deployment /// Parameters to validate. /// The cancellation token to use. /// , , or is null. - public Response ValidateAtScope(string scope, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default) + public Response ValidateAtScope(string scope, string deploymentName, DeploymentInput parameters, CancellationToken cancellationToken = default) { if (scope == null) { @@ -709,7 +709,7 @@ internal Azure.Core.HttpMessage CreateGetAtTenantScopeRequest(string deploymentN /// The name of the deployment. /// The cancellation token to use. /// is null. - public async Task> GetAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) + public async Task> GetAtTenantScopeAsync(string deploymentName, CancellationToken cancellationToken = default) { if (deploymentName == null) { @@ -722,13 +722,13 @@ public async Task> GetAtTenantScopeAsync(string { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -738,7 +738,7 @@ public async Task> GetAtTenantScopeAsync(string /// The name of the deployment. /// The cancellation token to use. /// is null. - public Response GetAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) + public Response GetAtTenantScope(string deploymentName, CancellationToken cancellationToken = default) { if (deploymentName == null) { @@ -751,13 +751,13 @@ public Response GetAtTenantScope(string deploymentName, { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -874,7 +874,7 @@ internal Azure.Core.HttpMessage CreateGetAtManagementGroupScopeRequest(string gr /// The name of the deployment. /// The cancellation token to use. /// or is null. - public async Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) + public async Task> GetAtManagementGroupScopeAsync(string groupId, string deploymentName, CancellationToken cancellationToken = default) { if (groupId == null) { @@ -891,13 +891,13 @@ public async Task> GetAtManagementGroupScopeAsy { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -908,7 +908,7 @@ public async Task> GetAtManagementGroupScopeAsy /// The name of the deployment. /// The cancellation token to use. /// or is null. - public Response GetAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) + public Response GetAtManagementGroupScope(string groupId, string deploymentName, CancellationToken cancellationToken = default) { if (groupId == null) { @@ -925,13 +925,13 @@ public Response GetAtManagementGroupScope(string groupId { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1060,7 +1060,7 @@ internal Azure.Core.HttpMessage CreateGetAtSubscriptionScopeRequest(string subsc /// The name of the deployment. /// The cancellation token to use. /// or is null. - public async Task> GetAtSubscriptionScopeAsync(string subscriptionId, string deploymentName, CancellationToken cancellationToken = default) + public async Task> GetAtSubscriptionScopeAsync(string subscriptionId, string deploymentName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -1077,13 +1077,13 @@ public async Task> GetAtSubscriptionScopeAsync( { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1094,7 +1094,7 @@ public async Task> GetAtSubscriptionScopeAsync( /// The name of the deployment. /// The cancellation token to use. /// or is null. - public Response GetAtSubscriptionScope(string subscriptionId, string deploymentName, CancellationToken cancellationToken = default) + public Response GetAtSubscriptionScope(string subscriptionId, string deploymentName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -1111,13 +1111,13 @@ public Response GetAtSubscriptionScope(string subscripti { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } @@ -1244,7 +1244,7 @@ internal Azure.Core.HttpMessage CreateGetRequest(string subscriptionId, string r /// The name of the deployment. /// The cancellation token to use. /// , , or is null. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -1265,13 +1265,13 @@ public async Task> GetAsync(string subscription { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); } @@ -1283,7 +1283,7 @@ public async Task> GetAsync(string subscription /// The name of the deployment. /// The cancellation token to use. /// , , or is null. - public Response Get(string subscriptionId, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default) { if (subscriptionId == null) { @@ -1304,13 +1304,13 @@ public Response Get(string subscriptionId, string resour { case 200: { - DeploymentExtendedData value = default; + DeploymentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = DeploymentExtendedData.DeserializeDeploymentExtendedData(document.RootElement); + value = DeploymentData.DeserializeDeploymentData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((DeploymentExtendedData)null, message.Response); + return Response.FromValue((DeploymentData)null, message.Response); default: throw _clientDiagnostics.CreateRequestFailedException(message.Response); } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/autorest.md b/sdk/resources/Azure.ResourceManager.Resources/src/autorest.md index da45828f2ca68..7169009ab9a21 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/autorest.md +++ b/sdk/resources/Azure.ResourceManager.Resources/src/autorest.md @@ -27,7 +27,7 @@ operation-group-to-resource-type: DeploymentScriptLogs: Microsoft.Resources/deploymentScripts/logs operation-group-to-resource: DeploymentOperations: DeploymentOperation - Deployments: DeploymentExtended + Deployments: Deployment DeploymentScripts: DeploymentScript ApplicationDefinitions: ApplicationDefinition DeploymentScriptLogs: ScriptLog @@ -39,6 +39,12 @@ operation-groups-to-omit: merge-operations: WhatIf: Deployments_WhatIf_POST;Deployments_WhatIfAtTenantScope_POST;Deployments_WhatIfAtManagementGroupScope_POST;Deployments_WhatIfAtSubscriptionScope_POST directive: + - from: resources.json + where: $.definitions.DeploymentExtended + transform: $['x-ms-client-name'] = 'Deployment' + - from: resources.json + where: $.definitions.Deployment + transform: $['x-ms-client-name'] = 'DeploymentInput' - remove-operation: checkResourceName # Use AtScope methods to replace the following operations # Keep the get method at each scope so that generator can know the possible values of container's parent diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/ResourcesTestBase.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/ResourcesTestBase.cs index b6fc24514eba0..a22eff2fb1df9 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/ResourcesTestBase.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/ResourcesTestBase.cs @@ -78,7 +78,7 @@ protected static DeploymentProperties CreateDeploymentProperties() return tmpDeploymentProperties; } - protected static Deployment CreateDeploymentExtendedData(DeploymentProperties deploymentProperties) => new Deployment(deploymentProperties); + protected static DeploymentInput CreateDeploymentData(DeploymentProperties deploymentProperties) => new DeploymentInput(deploymentProperties); private static GenericResourceData ConstructGenericUserAssignedIdentities() { diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeploymentExtendeds.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeploymentExtendeds.cs deleted file mode 100644 index bb12622bab581..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeploymentExtendeds.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -#region Snippet:Manage_DeploymentExtendeds_Namespaces -using System; -using System.Threading.Tasks; -using Azure.Identity; -using Azure.ResourceManager.Resources.Models; -using NUnit.Framework; -using JsonObject = System.Collections.Generic.Dictionary; -#endregion Manage_DeploymentExtendeds_Namespaces - -namespace Azure.ResourceManager.Resources.Tests.Samples -{ - public class Sample2_ManagingDeploymentExtendeds - { - private ResourceGroup resourceGroup; - - [Test] - [Ignore("Only verifying that the sample builds")] - public async Task CreateDeploymentExtendeds() - { - #region Snippet:Managing_DeploymentExtendeds_CreateADeploymentExtended - // First we need to get the deployment extended container from the resource group - DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); - // Use the same location as the resource group - string deploymentExtendedName = "myDeployment"; - var input = new Deployment(new DeploymentProperties(DeploymentMode.Incremental) - { - TemplateLink = new TemplateLink() - { - Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json" - }, - Parameters = new JsonObject() - { - {"storageAccountType", new JsonObject() - { - {"value", "Standard_GRS" } - } - } - } - }); - DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentExtendedContainer.CreateOrUpdateAsync(deploymentExtendedName, input); - DeploymentExtended deploymentExtended = lro.Value; - #endregion Snippet:Managing_DeploymentExtendeds_CreateADeploymentExtended - } - - [Test] - [Ignore("Only verifying that the sample builds")] - public async Task ListDeploymentExtendeds() - { - #region Snippet:Managing_DeploymentExtendeds_ListAllDeploymentExtendeds - // First we need to get the deployment extended container from the resource group - DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); - // With GetAllAsync(), we can get a list of the deployment extendeds in the container - AsyncPageable response = deploymentExtendedContainer.GetAllAsync(); - await foreach (DeploymentExtended deploymentExtended in response) - { - Console.WriteLine(deploymentExtended.Data.Name); - } - #endregion Snippet:Managing_DeploymentExtendeds_ListAllDeploymentExtendeds - } - - [Test] - [Ignore("Only verifying that the sample builds")] - public async Task DeleteDeploymentExtendeds() - { - #region Snippet:Managing_DeploymentExtendeds_DeleteADeploymentExtended - // First we need to get the deployment extended container from the resource group - DeploymentExtendedContainer deploymentExtendedContainer = resourceGroup.GetDeploymentExtendeds(); - // Now we can get the deployment extended with GetAsync() - DeploymentExtended deploymentExtended = await deploymentExtendedContainer.GetAsync("myDeployment"); - // With DeleteAsync(), we can delete the deployment extended - await deploymentExtended.DeleteAsync(); - #endregion Snippet:Managing_DeploymentExtendeds_DeleteADeploymentExtended - } - - [SetUp] - protected async Task initialize() - { - ArmClient armClient = new ArmClient(new DefaultAzureCredential()); - Subscription subscription = armClient.DefaultSubscription; - - ResourceGroupContainer rgContainer = subscription.GetResourceGroups(); - // With the container, we can create a new resource group with an specific name - string rgName = "myRgName"; - Location location = Location.WestUS2; - ResourceGroupCreateOrUpdateOperation lro = await rgContainer.CreateOrUpdateAsync(rgName, new ResourceGroupData(location)); - ResourceGroup resourceGroup = lro.Value; - - this.resourceGroup = resourceGroup; - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeployments.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeployments.cs new file mode 100644 index 0000000000000..d17a298a798e5 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Samples/Sample2_ManagingDeployments.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#region Snippet:Manage_Deployments_Namespaces +using System; +using System.Threading.Tasks; +using Azure.Identity; +using Azure.ResourceManager.Resources.Models; +using NUnit.Framework; +using JsonObject = System.Collections.Generic.Dictionary; +#endregion Manage_Deployments_Namespaces + +namespace Azure.ResourceManager.Resources.Tests.Samples +{ + public class Sample2_ManagingDeployments + { + private ResourceGroup resourceGroup; + + [Test] + [Ignore("Only verifying that the sample builds")] + public async Task CreateDeployments() + { + #region Snippet:Managing_Deployments_CreateADeployment + // First we need to get the deployment container from the resource group + DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); + // Use the same location as the resource group + string deploymentName = "myDeployment"; + var input = new DeploymentInput(new DeploymentProperties(DeploymentMode.Incremental) + { + TemplateLink = new TemplateLink() + { + Uri = "https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json" + }, + Parameters = new JsonObject() + { + {"storageAccountType", new JsonObject() + { + {"value", "Standard_GRS" } + } + } + } + }); + DeploymentCreateOrUpdateAtScopeOperation lro = await deploymentContainer.CreateOrUpdateAsync(deploymentName, input); + Deployment deployment = lro.Value; + #endregion Snippet:Managing_Deployments_CreateADeployment + } + + [Test] + [Ignore("Only verifying that the sample builds")] + public async Task ListDeployments() + { + #region Snippet:Managing_Deployments_ListAllDeployments + // First we need to get the deployment container from the resource group + DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); + // With GetAllAsync(), we can get a list of the deployments in the container + AsyncPageable response = deploymentContainer.GetAllAsync(); + await foreach (Deployment deployment in response) + { + Console.WriteLine(deployment.Data.Name); + } + #endregion Snippet:Managing_Deployments_ListAllDeployments + } + + [Test] + [Ignore("Only verifying that the sample builds")] + public async Task DeleteDeployments() + { + #region Snippet:Managing_Deployments_DeleteADeployment + // First we need to get the deployment container from the resource group + DeploymentContainer deploymentContainer = resourceGroup.GetDeployments(); + // Now we can get the deployment with GetAsync() + Deployment deployment = await deploymentContainer.GetAsync("myDeployment"); + // With DeleteAsync(), we can delete the deployment + await deployment.DeleteAsync(); + #endregion Snippet:Managing_Deployments_DeleteADeployment + } + + [SetUp] + protected async Task initialize() + { + ArmClient armClient = new ArmClient(new DefaultAzureCredential()); + Subscription subscription = armClient.DefaultSubscription; + + ResourceGroupContainer rgContainer = subscription.GetResourceGroups(); + // With the container, we can create a new resource group with an specific name + string rgName = "myRgName"; + Location location = Location.WestUS2; + ResourceGroupCreateOrUpdateOperation lro = await rgContainer.CreateOrUpdateAsync(rgName, new ResourceGroupData(location)); + ResourceGroup resourceGroup = lro.Value; + + this.resourceGroup = resourceGroup; + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentContainerTests.cs similarity index 83% rename from sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs rename to sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentContainerTests.cs index 37274a394df03..305528a6acb72 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentContainerTests.cs @@ -9,9 +9,9 @@ namespace Azure.ResourceManager.Resources.Tests { - public class DeploymentExtendedContainerTests : ResourcesTestBase + public class DeploymentContainerTests : ResourcesTestBase { - public DeploymentExtendedContainerTests(bool isAsync) + public DeploymentContainerTests(bool isAsync) : base(isAsync)//, RecordedTestMode.Record) { } @@ -25,11 +25,11 @@ public async Task CreateOrUpdate() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-C-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - DeploymentExtended deploymentExtended = (await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData)).Value; - Assert.AreEqual(deployExName, deploymentExtended.Data.Name); - Assert.ThrowsAsync(async () => _ = await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(null, deploymentExtendedData)); - Assert.ThrowsAsync(async () => _ = await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, null)); + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + Deployment deployment = (await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData)).Value; + Assert.AreEqual(deployExName, deployment.Data.Name); + Assert.ThrowsAsync(async () => _ = await rg.GetDeployments().CreateOrUpdateAsync(null, deploymentData)); + Assert.ThrowsAsync(async () => _ = await rg.GetDeployments().CreateOrUpdateAsync(deployExName, null)); } [TestCase] @@ -41,10 +41,10 @@ public async Task List() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-L-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - _ = await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData); + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + _ = await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData); int count = 0; - await foreach (var tempDeploymentExtended in rg.GetDeploymentExtendeds().GetAllAsync()) + await foreach (var tempDeployment in rg.GetDeployments().GetAllAsync()) { count++; } @@ -60,13 +60,13 @@ public async Task Get() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-G-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - DeploymentExtended deploymentExtended = (await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData)).Value; - DeploymentExtended getDeploymentExtended = await rg.GetDeploymentExtendeds().GetAsync(deployExName); - AssertValidDeploymentExtended(deploymentExtended, getDeploymentExtended); + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + Deployment deployment = (await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData)).Value; + Deployment getDeployment = await rg.GetDeployments().GetAsync(deployExName); + AssertValidDeployment(deployment, getDeployment); } - private static void AssertValidDeploymentExtended(DeploymentExtended model, DeploymentExtended getResult) + private static void AssertValidDeployment(Deployment model, Deployment getResult) { Assert.AreEqual(model.Data.Name, getResult.Data.Name); Assert.AreEqual(model.Data.Id, getResult.Data.Id); diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs index d25dc25232fab..2379cc7ecd4ea 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs @@ -24,10 +24,10 @@ public async Task List() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - DeploymentExtended deploymentExtended = (await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData)).Value; + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + Deployment deployment = (await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData)).Value; int count = 0; - await foreach (var tempDeploymentOperation in deploymentExtended.GetDeploymentOperations().GetAllAsync()) + await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperations().GetAllAsync()) { count++; } @@ -43,11 +43,11 @@ public async Task Get() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - DeploymentExtended deploymentExtended = (await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData)).Value; - await foreach (var tempDeploymentOperation in deploymentExtended.GetDeploymentOperations().GetAllAsync()) + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + Deployment deployment = (await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData)).Value; + await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperations().GetAllAsync()) { - DeploymentOperation getDeploymentOperation = await deploymentExtended.GetDeploymentOperations().GetAsync(tempDeploymentOperation.Data.OperationId); + DeploymentOperation getDeploymentOperation = await deployment.GetDeploymentOperations().GetAsync(tempDeploymentOperation.Data.OperationId); AssertValidDeploymentOperation(tempDeploymentOperation, getDeploymentOperation); } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationsTests.cs similarity index 65% rename from sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs rename to sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationsTests.cs index f0a74e6b040ab..67e9931f37079 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationsTests.cs @@ -8,9 +8,9 @@ namespace Azure.ResourceManager.Resources.Tests { - public class DeploymentExtendedOperationsTests : ResourcesTestBase + public class DeploymentOperationsTests : ResourcesTestBase { - public DeploymentExtendedOperationsTests(bool isAsync) + public DeploymentOperationsTests(bool isAsync) : base(isAsync)//, RecordedTestMode.Record) { } @@ -24,10 +24,10 @@ public async Task Delete() var lro = await Client.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(rgName, rgData); ResourceGroup rg = lro.Value; string deployExName = Recording.GenerateAssetName("deployEx-D-"); - Deployment deploymentExtendedData = CreateDeploymentExtendedData(CreateDeploymentProperties()); - DeploymentExtended deploymentExtended = (await rg.GetDeploymentExtendeds().CreateOrUpdateAsync(deployExName, deploymentExtendedData)).Value; - await deploymentExtended.DeleteAsync(); - var ex = Assert.ThrowsAsync(async () => await deploymentExtended.GetAsync()); + DeploymentInput deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + Deployment deployment = (await rg.GetDeployments().CreateOrUpdateAsync(deployExName, deploymentData)).Value; + await deployment.DeleteAsync(); + var ex = Assert.ThrowsAsync(async () => await deployment.GetAsync()); Assert.AreEqual(404, ex.Status); } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/CreateOrUpdate().json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/CreateOrUpdate().json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/CreateOrUpdate().json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/CreateOrUpdate().json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/CreateOrUpdate()Async.json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/CreateOrUpdate()Async.json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/CreateOrUpdate()Async.json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/CreateOrUpdate()Async.json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/Get().json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/Get().json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/Get().json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/Get().json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/Get()Async.json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/Get()Async.json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/Get()Async.json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/Get()Async.json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/List().json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/List().json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/List().json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/List().json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/List()Async.json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/List()Async.json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedContainerTests/List()Async.json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentContainerTests/List()Async.json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedOperationsTests/Delete().json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentOperationsTests/Delete().json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedOperationsTests/Delete().json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentOperationsTests/Delete().json diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedOperationsTests/Delete()Async.json b/sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentOperationsTests/Delete()Async.json similarity index 100% rename from sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentExtendedOperationsTests/Delete()Async.json rename to sdk/resources/Azure.ResourceManager.Resources/tests/SessionRecords/DeploymentOperationsTests/Delete()Async.json