diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs index fedf8287591f..818cbb6b532f 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs @@ -85,7 +85,7 @@ public static GraphServicesAccountResourceCollection GetGraphServicesAccountReso /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -109,7 +109,7 @@ public static async Task> GetGraphService /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs index 3204541bffed..f2021b12e170 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResource.cs @@ -34,8 +34,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _graphServicesAccountResourceAccountClientDiagnostics; - private readonly AccountRestOperations _graphServicesAccountResourceAccountRestClient; + private readonly ClientDiagnostics _graphServicesAccountResourceAccountsClientDiagnostics; + private readonly AccountsRestOperations _graphServicesAccountResourceAccountsRestClient; private readonly GraphServicesAccountResourceData _data; /// Initializes a new instance of the class for mocking. @@ -57,9 +57,9 @@ internal GraphServicesAccountResource(ArmClient client, GraphServicesAccountReso /// The identifier of the resource that is the target of operations. internal GraphServicesAccountResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _graphServicesAccountResourceAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GraphServices", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string graphServicesAccountResourceAccountApiVersion); - _graphServicesAccountResourceAccountRestClient = new AccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, graphServicesAccountResourceAccountApiVersion); + _graphServicesAccountResourceAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GraphServices", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string graphServicesAccountResourceAccountsApiVersion); + _graphServicesAccountResourceAccountsRestClient = new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, graphServicesAccountResourceAccountsApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -98,18 +98,18 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Get"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Get"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); @@ -130,18 +130,18 @@ public virtual async Task> GetAsync(Cance /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Get"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Get"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); @@ -162,7 +162,7 @@ public virtual Response Get(CancellationToken canc /// /// /// Operation Id - /// Account_Delete + /// Accounts_Delete /// /// /// @@ -170,11 +170,11 @@ public virtual Response Get(CancellationToken canc /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Delete"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Delete"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _graphServicesAccountResourceAccountsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new GraphServicesArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -196,7 +196,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Account_Delete + /// Accounts_Delete /// /// /// @@ -204,11 +204,11 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Delete"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Delete"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _graphServicesAccountResourceAccountsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new GraphServicesArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -230,7 +230,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Account_Update + /// Accounts_Update /// /// /// @@ -241,11 +241,11 @@ public virtual async Task> UpdateAsync(Gr { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Update"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Update"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var response = await _graphServicesAccountResourceAccountsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -264,7 +264,7 @@ public virtual async Task> UpdateAsync(Gr /// /// /// Operation Id - /// Account_Update + /// Accounts_Update /// /// /// @@ -275,11 +275,11 @@ public virtual Response Update(GraphServicesAccoun { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.Update"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.Update"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var response = _graphServicesAccountResourceAccountsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) @@ -298,7 +298,7 @@ public virtual Response Update(GraphServicesAccoun /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -311,7 +311,7 @@ public virtual async Task> AddTagAsync(st Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.AddTag"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.AddTag"); scope.Start(); try { @@ -320,7 +320,7 @@ public virtual async Task> AddTagAsync(st var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new GraphServicesAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -352,7 +352,7 @@ public virtual async Task> AddTagAsync(st /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -365,7 +365,7 @@ public virtual Response AddTag(string key, string Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.AddTag"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.AddTag"); scope.Start(); try { @@ -374,7 +374,7 @@ public virtual Response AddTag(string key, string var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _graphServicesAccountResourceAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new GraphServicesAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -406,7 +406,7 @@ public virtual Response AddTag(string key, string /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -417,7 +417,7 @@ public virtual async Task> SetTagsAsync(I { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.SetTags"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.SetTags"); scope.Start(); try { @@ -427,7 +427,7 @@ public virtual async Task> SetTagsAsync(I var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new GraphServicesAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -455,7 +455,7 @@ public virtual async Task> SetTagsAsync(I /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -466,7 +466,7 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary SetTags(IDictionary /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -515,7 +515,7 @@ public virtual async Task> RemoveTagAsync { Argument.AssertNotNull(key, nameof(key)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.RemoveTag"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.RemoveTag"); scope.Start(); try { @@ -524,7 +524,7 @@ public virtual async Task> RemoveTagAsync var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new GraphServicesAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -556,7 +556,7 @@ public virtual async Task> RemoveTagAsync /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -567,7 +567,7 @@ public virtual Response RemoveTag(string key, Canc { Argument.AssertNotNull(key, nameof(key)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResource.RemoveTag"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResource.RemoveTag"); scope.Start(); try { @@ -576,7 +576,7 @@ public virtual Response RemoveTag(string key, Canc var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _graphServicesAccountResourceAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new GraphServicesAccountResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs index 00a09a3243f6..dc9bf4e9194c 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/GraphServicesAccountResourceCollection.cs @@ -26,8 +26,6 @@ namespace Azure.ResourceManager.GraphServices /// public partial class GraphServicesAccountResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _graphServicesAccountResourceAccountClientDiagnostics; - private readonly AccountRestOperations _graphServicesAccountResourceAccountRestClient; private readonly ClientDiagnostics _graphServicesAccountResourceAccountsClientDiagnostics; private readonly AccountsRestOperations _graphServicesAccountResourceAccountsRestClient; @@ -41,9 +39,6 @@ protected GraphServicesAccountResourceCollection() /// The identifier of the parent resource that is the target of operations. internal GraphServicesAccountResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _graphServicesAccountResourceAccountClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GraphServices", GraphServicesAccountResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(GraphServicesAccountResource.ResourceType, out string graphServicesAccountResourceAccountApiVersion); - _graphServicesAccountResourceAccountRestClient = new AccountRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, graphServicesAccountResourceAccountApiVersion); _graphServicesAccountResourceAccountsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GraphServices", GraphServicesAccountResource.ResourceType.Namespace, Diagnostics); TryGetApiVersion(GraphServicesAccountResource.ResourceType, out string graphServicesAccountResourceAccountsApiVersion); _graphServicesAccountResourceAccountsRestClient = new AccountsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, graphServicesAccountResourceAccountsApiVersion); @@ -67,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Account_CreateAndUpdate + /// Accounts_CreateAndUpdate /// /// /// @@ -82,12 +77,12 @@ public virtual async Task> CreateOrUp Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.CreateOrUpdate"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.CreateAndUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); - var operation = new GraphServicesArmOperation(new GraphServicesAccountResourceOperationSource(Client), _graphServicesAccountResourceAccountClientDiagnostics, Pipeline, _graphServicesAccountResourceAccountRestClient.CreateCreateAndUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _graphServicesAccountResourceAccountsRestClient.CreateAndUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new GraphServicesArmOperation(new GraphServicesAccountResourceOperationSource(Client), _graphServicesAccountResourceAccountsClientDiagnostics, Pipeline, _graphServicesAccountResourceAccountsRestClient.CreateCreateAndUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -108,7 +103,7 @@ public virtual async Task> CreateOrUp /// /// /// Operation Id - /// Account_CreateAndUpdate + /// Accounts_CreateAndUpdate /// /// /// @@ -123,12 +118,12 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.CreateOrUpdate"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.CreateAndUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); - var operation = new GraphServicesArmOperation(new GraphServicesAccountResourceOperationSource(Client), _graphServicesAccountResourceAccountClientDiagnostics, Pipeline, _graphServicesAccountResourceAccountRestClient.CreateCreateAndUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _graphServicesAccountResourceAccountsRestClient.CreateAndUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); + var operation = new GraphServicesArmOperation(new GraphServicesAccountResourceOperationSource(Client), _graphServicesAccountResourceAccountsClientDiagnostics, Pipeline, _graphServicesAccountResourceAccountsRestClient.CreateCreateAndUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -149,7 +144,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUnt /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -161,11 +156,11 @@ public virtual async Task> GetAsync(strin { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Get"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Get"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); + var response = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); @@ -186,7 +181,7 @@ public virtual async Task> GetAsync(strin /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -198,11 +193,11 @@ public virtual Response Get(string resourceName, C { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Get"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Get"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); + var response = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new GraphServicesAccountResource(Client, response.Value), response.GetRawResponse()); @@ -267,7 +262,7 @@ public virtual Pageable GetAll(CancellationToken c /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -279,11 +274,11 @@ public virtual async Task> ExistsAsync(string resourceName, Cance { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Exists"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Exists"); scope.Start(); try { - var response = await _graphServicesAccountResourceAccountRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _graphServicesAccountResourceAccountsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -302,7 +297,7 @@ public virtual async Task> ExistsAsync(string resourceName, Cance /// /// /// Operation Id - /// Account_Get + /// Accounts_Get /// /// /// @@ -314,11 +309,11 @@ public virtual Response Exists(string resourceName, CancellationToken canc { Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - using var scope = _graphServicesAccountResourceAccountClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Exists"); + using var scope = _graphServicesAccountResourceAccountsClientDiagnostics.CreateScope("GraphServicesAccountResourceCollection.Exists"); scope.Start(); try { - var response = _graphServicesAccountResourceAccountRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); + var response = _graphServicesAccountResourceAccountsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountRestOperations.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountRestOperations.cs deleted file mode 100644 index e3ea8a388349..000000000000 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountRestOperations.cs +++ /dev/null @@ -1,356 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.GraphServices.Models; - -namespace Azure.ResourceManager.GraphServices -{ - internal partial class AccountRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of AccountRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// server parameter. - /// Api Version. - /// or is null. - public AccountRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) - { - _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-22-preview"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); - uri.AppendPath(resourceName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Returns account resource for a given name. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - GraphServicesAccountResourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((GraphServicesAccountResourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Returns account resource for a given name. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - GraphServicesAccountResourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((GraphServicesAccountResourceData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCreateAndUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); - uri.AppendPath(resourceName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Create or update account resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// Account details. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateAndUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateAndUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Create or update account resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// Account details. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateAndUpdate(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateCreateAndUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); - uri.AppendPath(resourceName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Update account details. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// Account patch details. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - GraphServicesAccountResourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Update account details. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// Account patch details. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(patch, nameof(patch)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - GraphServicesAccountResourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); - uri.AppendPath(resourceName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes a account resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes a account resource. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. - /// The name of the resource. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountsRestOperations.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountsRestOperations.cs index e67616e557ee..b04f43c306a2 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountsRestOperations.cs +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/RestOperations/AccountsRestOperations.cs @@ -33,7 +33,7 @@ public AccountsRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-09-22-preview"; + _apiVersion = apiVersion ?? "2023-04-13"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -177,6 +177,322 @@ public Response ListBySubscription(string subs } } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns account resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GraphServicesAccountResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GraphServicesAccountResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns account resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GraphServicesAccountResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GraphServicesAccountResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateAndUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAndUpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateAndUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateAndUpdate(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateAndUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update account details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account patch details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GraphServicesAccountResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update account details. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// Account patch details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string resourceName, GraphServicesAccountResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GraphServicesAccountResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GraphServicesAccountResourceData.DeserializeGraphServicesAccountResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.GraphServices/accounts/", false); + uri.AppendPath(resourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a account resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); diff --git a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/autorest.md b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/autorest.md index 54250034f182..82577443c3bb 100644 --- a/sdk/graphservices/Azure.ResourceManager.GraphServices/src/autorest.md +++ b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: GraphServices namespace: Azure.ResourceManager.GraphServices -require: https://github.com/Azure/azure-rest-api-specs/blob/844b06b77ca841a151a6aa2a459f126e277f3c77/specification/graphservicesprod/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/f4f89f1baf008a573b727804b61732eb87ee266c/specification/graphservicesprod/resource-manager/readme.md # tag: package-2022-09-22-preview output-folder: $(this-folder)/Generated clear-output-folder: true