From 40aa41be06a75480c446e35c365dfaf853756207 Mon Sep 17 00:00:00 2001 From: m-nash <64171366+m-nash@users.noreply.github.com> Date: Wed, 11 Aug 2021 20:43:34 -0700 Subject: [PATCH] rename tagoperatoins property (#23280) * update simple resources to no longer have operations rename ResourceOperations to ArmResource rename ResourceContainer to ArmContainer * combine genericResource and genericResourceExpanded add test case to validate the expand deserializes properly * combine managementGroupInfo and manageGroup * update core tests after changes * update fields to be consistent with autorest * update after test interceptor changes * update to take resourceidentifier differentiate between a tenant provider and a subscription provider add overloads to get generic resource list to take string and resource identifier * update api after changes * add test case to validate bad sub id being passed into armclient * temporarily use alpha version of core * remove unused overload * add recording so test can be played back in ci * use testenv creds * update tagresource name * update after merge * update api --- .../api/Azure.ResourceManager.netstandard2.0.cs | 2 +- .../Azure.ResourceManager/src/ArmResource.cs | 4 ++-- .../src/Generated/Resources/GenericResource.cs | 16 ++++++++-------- .../src/Generated/Resources/ResourceGroup.cs | 16 ++++++++-------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs b/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs index 70a6ea7112f1..00d06b5f3a2e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/api/Azure.ResourceManager.netstandard2.0.cs @@ -180,7 +180,7 @@ protected ArmResource(Azure.ResourceManager.Core.ArmResource parentOperations, A public virtual Azure.ResourceManager.ResourceIdentifier Id { get { throw null; } } protected internal virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } protected internal Azure.ResourceManager.Resources.TagResourceContainer TagContainer { get { throw null; } } - protected internal Azure.ResourceManager.Resources.TagResource TagResourceOperations { get { throw null; } } + protected internal Azure.ResourceManager.Resources.TagResource TagResource { get { throw null; } } protected abstract Azure.ResourceManager.ResourceType ValidResourceType { get; } protected System.Collections.Generic.IEnumerable ListAvailableLocations(Azure.ResourceManager.ResourceType resourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } protected System.Threading.Tasks.Task> ListAvailableLocationsAsync(Azure.ResourceManager.ResourceType resourceType, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/ArmResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ArmResource.cs index b3d6ea07c9e7..c24ae28ad15e 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/ArmResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/ArmResource.cs @@ -19,7 +19,7 @@ namespace Azure.ResourceManager.Core public abstract class ArmResource { private TagResourceContainer _tagContainer; - private TagResource _tagResourceOperations; + private TagResource _tagResource; private Tenant _tenant; /// @@ -91,7 +91,7 @@ internal ArmResource(ClientContext clientContext, ResourceIdentifier id) /// Gets the TagResourceOperations. /// /// A TagResourceOperations. - protected internal TagResource TagResourceOperations => _tagResourceOperations ??= new TagResource(this, Id); + protected internal TagResource TagResource => _tagResource ??= new TagResource(this, Id); /// /// Gets the TagsOperations. diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResource.cs index a1cecb3ec861..c002246371e0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/GenericResource.cs @@ -188,7 +188,7 @@ public virtual Response AddTag(string key, string value, Cancel try { var apiVersion = GetApiVersion(cancellationToken); - var originalTags = TagResourceOperations.Get(cancellationToken).Value; + var originalTags = TagResource.Get(cancellationToken).Value; originalTags.Data.Properties.TagsValue[key] = value; TagContainer.CreateOrUpdate(originalTags.Data, cancellationToken); var originalResponse = _restClient.GetById(Id, apiVersion, cancellationToken); @@ -215,7 +215,7 @@ public virtual async Task> AddTagAsync(string key, str try { var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); - var originalTags = (await TagResourceOperations.GetAsync(cancellationToken).ConfigureAwait(false)).Value; + var originalTags = (await TagResource.GetAsync(cancellationToken).ConfigureAwait(false)).Value; originalTags.Data.Properties.TagsValue[key] = value; await TagContainer.CreateOrUpdateAsync(originalTags.Data, cancellationToken).ConfigureAwait(false); var originalResponse = await _restClient.GetByIdAsync(Id, apiVersion, cancellationToken).ConfigureAwait(false); @@ -292,8 +292,8 @@ public virtual Response SetTags(IDictionary tag try { var apiVersion = GetApiVersion(cancellationToken); - TagResourceOperations.Delete(cancellationToken); - var newTags = TagResourceOperations.Get(cancellationToken); + TagResource.Delete(cancellationToken); + var newTags = TagResource.Get(cancellationToken); newTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagContainer.CreateOrUpdate(new TagResourceData(newTags.Value.Data.Properties), cancellationToken); var originalResponse = _restClient.GetById(Id, apiVersion, cancellationToken); @@ -319,8 +319,8 @@ public virtual async Task> SetTagsAsync(IDictionary RemoveTag(string key, CancellationToken try { var apiVersion = GetApiVersion(cancellationToken); - var originalTags = TagResourceOperations.Get(cancellationToken).Value; + var originalTags = TagResource.Get(cancellationToken).Value; originalTags.Data.Properties.TagsValue.Remove(key); TagContainer.CreateOrUpdate(originalTags.Data, cancellationToken); var originalResponse = _restClient.GetById(Id, apiVersion, cancellationToken); @@ -372,7 +372,7 @@ public virtual async Task> RemoveTagAsync(string key, try { var apiVersion = await GetApiVersionAsync(cancellationToken).ConfigureAwait(false); - var originalTags = (await TagResourceOperations.GetAsync(cancellationToken).ConfigureAwait(false)).Value; + var originalTags = (await TagResource.GetAsync(cancellationToken).ConfigureAwait(false)).Value; originalTags.Data.Properties.TagsValue.Remove(key); await TagContainer.CreateOrUpdateAsync(originalTags.Data, cancellationToken).ConfigureAwait(false); var originalResponse = await _restClient.GetByIdAsync(Id, apiVersion, cancellationToken).ConfigureAwait(false); diff --git a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroup.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroup.cs index fc445aab75e5..d1a863eaf00a 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroup.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Generated/Resources/ResourceGroup.cs @@ -327,7 +327,7 @@ public virtual Response AddTag(string key, string value, Cancella try { - var originalTags = TagResourceOperations.Get(cancellationToken).Value; + var originalTags = TagResource.Get(cancellationToken).Value; originalTags.Data.Properties.TagsValue[key] = value; TagContainer.CreateOrUpdate(originalTags.Data, cancellationToken); var originalResponse = _restClient.Get(Id.Name, cancellationToken); @@ -357,7 +357,7 @@ public virtual async Task> AddTagAsync(string key, strin try { - var originalTags = await TagResourceOperations.GetAsync(cancellationToken).ConfigureAwait(false); + var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue[key] = value; await TagContainer.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken).ConfigureAwait(false); var originalResponse = await _restClient.GetAsync(Id.Name, cancellationToken).ConfigureAwait(false); @@ -386,8 +386,8 @@ public virtual Response SetTags(IDictionary tags, try { - TagResourceOperations.Delete(cancellationToken); - var newTags = TagResourceOperations.Get(cancellationToken); + TagResource.Delete(cancellationToken); + var newTags = TagResource.Get(cancellationToken); newTags.Value.Data.Properties.TagsValue.ReplaceWith(tags); TagContainer.CreateOrUpdate(new TagResourceData(newTags.Value.Data.Properties), cancellationToken); var originalResponse = _restClient.Get(Id.Name, cancellationToken); @@ -416,8 +416,8 @@ public virtual async Task> SetTagsAsync(IDictionary RemoveTag(string key, CancellationToken c try { - var originalTags = TagResourceOperations.Get(cancellationToken).Value; + var originalTags = TagResource.Get(cancellationToken).Value; originalTags.Data.Properties.TagsValue.Remove(key); TagContainer.CreateOrUpdate(originalTags.Data, cancellationToken); var originalResponse = _restClient.Get(Id.Name, cancellationToken); @@ -475,7 +475,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca try { - var originalTags = await TagResourceOperations.GetAsync(cancellationToken).ConfigureAwait(false); + var originalTags = await TagResource.GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.Properties.TagsValue.Remove(key); await TagContainer.CreateOrUpdateAsync(originalTags.Value.Data, cancellationToken).ConfigureAwait(false); var originalResponse = await _restClient.GetAsync(Id.Name, cancellationToken).ConfigureAwait(false);