< Summary

Class:Azure.ResourceManager.Storage.StorageAccountsRestOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\StorageAccountsRestOperations.cs
Covered lines:453
Uncovered lines:198
Coverable lines:651
Total lines:1388
Line coverage:69.5% (453 of 651)
Covered branches:113
Total branches:248
Branch coverage:45.5% (113 of 248)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
CreateCheckNameAvailabilityRequest(...)-100%100%
CheckNameAvailabilityAsync()-76.92%50%
CheckNameAvailability(...)-76.92%50%
CreateCreateRequest(...)-100%100%
CreateAsync()-75%70%
Create(...)-75%70%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%62.5%
Delete(...)-70%62.5%
CreateGetPropertiesRequest(...)-100%100%
GetPropertiesAsync()-73.33%50%
GetProperties(...)-73.33%50%
CreateUpdateRequest(...)-100%100%
UpdateAsync()-76.47%60%
Update(...)-76.47%60%
CreateListRequest()-100%100%
ListAsync()-81.82%50%
List(...)-81.82%50%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-76.92%50%
ListByResourceGroup(...)-76.92%50%
CreateListKeysRequest(...)-100%100%
ListKeysAsync()-73.33%50%
ListKeys(...)-73.33%50%
CreateRegenerateKeyRequest(...)-100%100%
RegenerateKeyAsync()-70.59%50%
RegenerateKey(...)-70.59%50%
CreateListAccountSASRequest(...)-100%100%
ListAccountSASAsync()-76.47%60%
ListAccountSAS(...)-76.47%60%
CreateListServiceSASRequest(...)-100%100%
ListServiceSASAsync()-76.47%60%
ListServiceSAS(...)-76.47%60%
CreateFailoverRequest(...)-0%100%
FailoverAsync()-0%0%
Failover(...)-0%0%
CreateRestoreBlobRangesRequest(...)-0%100%
RestoreBlobRangesAsync()-0%0%
RestoreBlobRanges(...)-0%0%
CreateRevokeUserDelegationKeysRequest(...)-100%100%
RevokeUserDelegationKeysAsync()-70%50%
RevokeUserDelegationKeys(...)-70%50%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\StorageAccountsRestOperations.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Text.Json;
 10using System.Threading;
 11using System.Threading.Tasks;
 12using Azure;
 13using Azure.Core;
 14using Azure.Core.Pipeline;
 15using Azure.ResourceManager.Storage.Models;
 16
 17namespace Azure.ResourceManager.Storage
 18{
 19    internal partial class StorageAccountsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private string apiVersion;
 24        private ClientDiagnostics _clientDiagnostics;
 25        private HttpPipeline _pipeline;
 26
 27        /// <summary> Initializes a new instance of StorageAccountsRestOperations. </summary>
 28        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 29        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 30        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 31        /// <param name="endpoint"> server parameter. </param>
 32        /// <param name="apiVersion"> Api Version. </param>
 33        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 24034        public StorageAccountsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 35        {
 24036            if (subscriptionId == null)
 37            {
 038                throw new ArgumentNullException(nameof(subscriptionId));
 39            }
 24040            endpoint ??= new Uri("https://management.azure.com");
 24041            if (apiVersion == null)
 42            {
 043                throw new ArgumentNullException(nameof(apiVersion));
 44            }
 45
 24046            this.subscriptionId = subscriptionId;
 24047            this.endpoint = endpoint;
 24048            this.apiVersion = apiVersion;
 24049            _clientDiagnostics = clientDiagnostics;
 24050            _pipeline = pipeline;
 24051        }
 52
 53        internal HttpMessage CreateCheckNameAvailabilityRequest(StorageAccountCheckNameAvailabilityParameters accountNam
 54        {
 1255            var message = _pipeline.CreateMessage();
 1256            var request = message.Request;
 1257            request.Method = RequestMethod.Post;
 1258            var uri = new RawRequestUriBuilder();
 1259            uri.Reset(endpoint);
 1260            uri.AppendPath("/subscriptions/", false);
 1261            uri.AppendPath(subscriptionId, true);
 1262            uri.AppendPath("/providers/Microsoft.Storage/checkNameAvailability", false);
 1263            uri.AppendQuery("api-version", apiVersion, true);
 1264            request.Uri = uri;
 1265            request.Headers.Add("Content-Type", "application/json");
 1266            var content = new Utf8JsonRequestContent();
 1267            content.JsonWriter.WriteObjectValue(accountName);
 1268            request.Content = content;
 1269            return message;
 70        }
 71
 72        /// <summary> Checks that the storage account name is valid and is not already in use. </summary>
 73        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 74        /// <param name="cancellationToken"> The cancellation token to use. </param>
 75        public async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(StorageAccountCheckNameAvail
 76        {
 677            if (accountName == null)
 78            {
 079                throw new ArgumentNullException(nameof(accountName));
 80            }
 81
 682            using var message = CreateCheckNameAvailabilityRequest(accountName);
 683            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 684            switch (message.Response.Status)
 85            {
 86                case 200:
 87                    {
 688                        CheckNameAvailabilityResult value = default;
 689                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 690                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 91                        {
 092                            value = null;
 93                        }
 94                        else
 95                        {
 696                            value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElem
 97                        }
 698                        return Response.FromValue(value, message.Response);
 99                    }
 100                default:
 0101                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 102            }
 6103        }
 104
 105        /// <summary> Checks that the storage account name is valid and is not already in use. </summary>
 106        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 107        /// <param name="cancellationToken"> The cancellation token to use. </param>
 108        public Response<CheckNameAvailabilityResult> CheckNameAvailability(StorageAccountCheckNameAvailabilityParameters
 109        {
 6110            if (accountName == null)
 111            {
 0112                throw new ArgumentNullException(nameof(accountName));
 113            }
 114
 6115            using var message = CreateCheckNameAvailabilityRequest(accountName);
 6116            _pipeline.Send(message, cancellationToken);
 6117            switch (message.Response.Status)
 118            {
 119                case 200:
 120                    {
 6121                        CheckNameAvailabilityResult value = default;
 6122                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6123                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 124                        {
 0125                            value = null;
 126                        }
 127                        else
 128                        {
 6129                            value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElem
 130                        }
 6131                        return Response.FromValue(value, message.Response);
 132                    }
 133                default:
 0134                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 135            }
 6136        }
 137
 138        internal HttpMessage CreateCreateRequest(string resourceGroupName, string accountName, StorageAccountCreateParam
 139        {
 588140            var message = _pipeline.CreateMessage();
 588141            var request = message.Request;
 588142            request.Method = RequestMethod.Put;
 588143            var uri = new RawRequestUriBuilder();
 588144            uri.Reset(endpoint);
 588145            uri.AppendPath("/subscriptions/", false);
 588146            uri.AppendPath(subscriptionId, true);
 588147            uri.AppendPath("/resourceGroups/", false);
 588148            uri.AppendPath(resourceGroupName, true);
 588149            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 588150            uri.AppendPath(accountName, true);
 588151            uri.AppendQuery("api-version", apiVersion, true);
 588152            request.Uri = uri;
 588153            request.Headers.Add("Content-Type", "application/json");
 588154            var content = new Utf8JsonRequestContent();
 588155            content.JsonWriter.WriteObjectValue(parameters);
 588156            request.Content = content;
 588157            return message;
 158        }
 159
 160        /// <summary> Asynchronously creates a new storage account with the specified parameters. If an account is alrea
 161        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 162        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 163        /// <param name="parameters"> The parameters to provide for the created account. </param>
 164        /// <param name="cancellationToken"> The cancellation token to use. </param>
 165        public async Task<Response> CreateAsync(string resourceGroupName, string accountName, StorageAccountCreateParame
 166        {
 148167            if (resourceGroupName == null)
 168            {
 0169                throw new ArgumentNullException(nameof(resourceGroupName));
 170            }
 148171            if (accountName == null)
 172            {
 0173                throw new ArgumentNullException(nameof(accountName));
 174            }
 148175            if (parameters == null)
 176            {
 0177                throw new ArgumentNullException(nameof(parameters));
 178            }
 179
 148180            using var message = CreateCreateRequest(resourceGroupName, accountName, parameters);
 148181            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 148182            switch (message.Response.Status)
 183            {
 184                case 200:
 185                case 202:
 146186                    return message.Response;
 187                default:
 2188                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 189            }
 146190        }
 191
 192        /// <summary> Asynchronously creates a new storage account with the specified parameters. If an account is alrea
 193        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 194        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 195        /// <param name="parameters"> The parameters to provide for the created account. </param>
 196        /// <param name="cancellationToken"> The cancellation token to use. </param>
 197        public Response Create(string resourceGroupName, string accountName, StorageAccountCreateParameters parameters, 
 198        {
 148199            if (resourceGroupName == null)
 200            {
 0201                throw new ArgumentNullException(nameof(resourceGroupName));
 202            }
 148203            if (accountName == null)
 204            {
 0205                throw new ArgumentNullException(nameof(accountName));
 206            }
 148207            if (parameters == null)
 208            {
 0209                throw new ArgumentNullException(nameof(parameters));
 210            }
 211
 148212            using var message = CreateCreateRequest(resourceGroupName, accountName, parameters);
 148213            _pipeline.Send(message, cancellationToken);
 148214            switch (message.Response.Status)
 215            {
 216                case 200:
 217                case 202:
 146218                    return message.Response;
 219                default:
 2220                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 221            }
 146222        }
 223
 224        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName)
 225        {
 12226            var message = _pipeline.CreateMessage();
 12227            var request = message.Request;
 12228            request.Method = RequestMethod.Delete;
 12229            var uri = new RawRequestUriBuilder();
 12230            uri.Reset(endpoint);
 12231            uri.AppendPath("/subscriptions/", false);
 12232            uri.AppendPath(subscriptionId, true);
 12233            uri.AppendPath("/resourceGroups/", false);
 12234            uri.AppendPath(resourceGroupName, true);
 12235            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12236            uri.AppendPath(accountName, true);
 12237            uri.AppendQuery("api-version", apiVersion, true);
 12238            request.Uri = uri;
 12239            return message;
 240        }
 241
 242        /// <summary> Deletes a storage account in Microsoft Azure. </summary>
 243        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 244        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 245        /// <param name="cancellationToken"> The cancellation token to use. </param>
 246        public async Task<Response> DeleteAsync(string resourceGroupName, string accountName, CancellationToken cancella
 247        {
 6248            if (resourceGroupName == null)
 249            {
 0250                throw new ArgumentNullException(nameof(resourceGroupName));
 251            }
 6252            if (accountName == null)
 253            {
 0254                throw new ArgumentNullException(nameof(accountName));
 255            }
 256
 6257            using var message = CreateDeleteRequest(resourceGroupName, accountName);
 6258            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6259            switch (message.Response.Status)
 260            {
 261                case 200:
 262                case 204:
 6263                    return message.Response;
 264                default:
 0265                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 266            }
 6267        }
 268
 269        /// <summary> Deletes a storage account in Microsoft Azure. </summary>
 270        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 271        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken = defau
 274        {
 6275            if (resourceGroupName == null)
 276            {
 0277                throw new ArgumentNullException(nameof(resourceGroupName));
 278            }
 6279            if (accountName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(accountName));
 282            }
 283
 6284            using var message = CreateDeleteRequest(resourceGroupName, accountName);
 6285            _pipeline.Send(message, cancellationToken);
 6286            switch (message.Response.Status)
 287            {
 288                case 200:
 289                case 204:
 6290                    return message.Response;
 291                default:
 0292                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 293            }
 6294        }
 295
 296        internal HttpMessage CreateGetPropertiesRequest(string resourceGroupName, string accountName, StorageAccountExpa
 297        {
 116298            var message = _pipeline.CreateMessage();
 116299            var request = message.Request;
 116300            request.Method = RequestMethod.Get;
 116301            var uri = new RawRequestUriBuilder();
 116302            uri.Reset(endpoint);
 116303            uri.AppendPath("/subscriptions/", false);
 116304            uri.AppendPath(subscriptionId, true);
 116305            uri.AppendPath("/resourceGroups/", false);
 116306            uri.AppendPath(resourceGroupName, true);
 116307            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 116308            uri.AppendPath(accountName, true);
 116309            uri.AppendQuery("api-version", apiVersion, true);
 116310            if (expand != null)
 311            {
 4312                uri.AppendQuery("$expand", expand.Value.ToSerialString(), true);
 313            }
 116314            request.Uri = uri;
 116315            return message;
 316        }
 317
 318        /// <summary> Returns the properties for the specified storage account including but not limited to name, SKU na
 319        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 320        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 321        /// <param name="expand"> May be used to expand the properties within account&apos;s properties. By default, dat
 322        /// <param name="cancellationToken"> The cancellation token to use. </param>
 323        public async Task<Response<StorageAccount>> GetPropertiesAsync(string resourceGroupName, string accountName, Sto
 324        {
 58325            if (resourceGroupName == null)
 326            {
 0327                throw new ArgumentNullException(nameof(resourceGroupName));
 328            }
 58329            if (accountName == null)
 330            {
 0331                throw new ArgumentNullException(nameof(accountName));
 332            }
 333
 58334            using var message = CreateGetPropertiesRequest(resourceGroupName, accountName, expand);
 58335            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 58336            switch (message.Response.Status)
 337            {
 338                case 200:
 339                    {
 58340                        StorageAccount value = default;
 58341                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 58342                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 343                        {
 0344                            value = null;
 345                        }
 346                        else
 347                        {
 58348                            value = StorageAccount.DeserializeStorageAccount(document.RootElement);
 349                        }
 58350                        return Response.FromValue(value, message.Response);
 351                    }
 352                default:
 0353                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 354            }
 58355        }
 356
 357        /// <summary> Returns the properties for the specified storage account including but not limited to name, SKU na
 358        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 359        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 360        /// <param name="expand"> May be used to expand the properties within account&apos;s properties. By default, dat
 361        /// <param name="cancellationToken"> The cancellation token to use. </param>
 362        public Response<StorageAccount> GetProperties(string resourceGroupName, string accountName, StorageAccountExpand
 363        {
 58364            if (resourceGroupName == null)
 365            {
 0366                throw new ArgumentNullException(nameof(resourceGroupName));
 367            }
 58368            if (accountName == null)
 369            {
 0370                throw new ArgumentNullException(nameof(accountName));
 371            }
 372
 58373            using var message = CreateGetPropertiesRequest(resourceGroupName, accountName, expand);
 58374            _pipeline.Send(message, cancellationToken);
 58375            switch (message.Response.Status)
 376            {
 377                case 200:
 378                    {
 58379                        StorageAccount value = default;
 58380                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 58381                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 382                        {
 0383                            value = null;
 384                        }
 385                        else
 386                        {
 58387                            value = StorageAccount.DeserializeStorageAccount(document.RootElement);
 388                        }
 58389                        return Response.FromValue(value, message.Response);
 390                    }
 391                default:
 0392                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 393            }
 58394        }
 395
 396        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accountName, StorageAccountUpdateParam
 397        {
 60398            var message = _pipeline.CreateMessage();
 60399            var request = message.Request;
 60400            request.Method = RequestMethod.Patch;
 60401            var uri = new RawRequestUriBuilder();
 60402            uri.Reset(endpoint);
 60403            uri.AppendPath("/subscriptions/", false);
 60404            uri.AppendPath(subscriptionId, true);
 60405            uri.AppendPath("/resourceGroups/", false);
 60406            uri.AppendPath(resourceGroupName, true);
 60407            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 60408            uri.AppendPath(accountName, true);
 60409            uri.AppendQuery("api-version", apiVersion, true);
 60410            request.Uri = uri;
 60411            request.Headers.Add("Content-Type", "application/json");
 60412            var content = new Utf8JsonRequestContent();
 60413            content.JsonWriter.WriteObjectValue(parameters);
 60414            request.Content = content;
 60415            return message;
 416        }
 417
 418        /// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage
 419        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 420        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 421        /// <param name="parameters"> The parameters to provide for the updated account. </param>
 422        /// <param name="cancellationToken"> The cancellation token to use. </param>
 423        public async Task<Response<StorageAccount>> UpdateAsync(string resourceGroupName, string accountName, StorageAcc
 424        {
 30425            if (resourceGroupName == null)
 426            {
 0427                throw new ArgumentNullException(nameof(resourceGroupName));
 428            }
 30429            if (accountName == null)
 430            {
 0431                throw new ArgumentNullException(nameof(accountName));
 432            }
 30433            if (parameters == null)
 434            {
 0435                throw new ArgumentNullException(nameof(parameters));
 436            }
 437
 30438            using var message = CreateUpdateRequest(resourceGroupName, accountName, parameters);
 30439            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 30440            switch (message.Response.Status)
 441            {
 442                case 200:
 443                    {
 28444                        StorageAccount value = default;
 28445                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 28446                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 447                        {
 0448                            value = null;
 449                        }
 450                        else
 451                        {
 28452                            value = StorageAccount.DeserializeStorageAccount(document.RootElement);
 453                        }
 28454                        return Response.FromValue(value, message.Response);
 455                    }
 456                default:
 2457                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 458            }
 28459        }
 460
 461        /// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage
 462        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 463        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 464        /// <param name="parameters"> The parameters to provide for the updated account. </param>
 465        /// <param name="cancellationToken"> The cancellation token to use. </param>
 466        public Response<StorageAccount> Update(string resourceGroupName, string accountName, StorageAccountUpdateParamet
 467        {
 30468            if (resourceGroupName == null)
 469            {
 0470                throw new ArgumentNullException(nameof(resourceGroupName));
 471            }
 30472            if (accountName == null)
 473            {
 0474                throw new ArgumentNullException(nameof(accountName));
 475            }
 30476            if (parameters == null)
 477            {
 0478                throw new ArgumentNullException(nameof(parameters));
 479            }
 480
 30481            using var message = CreateUpdateRequest(resourceGroupName, accountName, parameters);
 30482            _pipeline.Send(message, cancellationToken);
 30483            switch (message.Response.Status)
 484            {
 485                case 200:
 486                    {
 28487                        StorageAccount value = default;
 28488                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 28489                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 490                        {
 0491                            value = null;
 492                        }
 493                        else
 494                        {
 28495                            value = StorageAccount.DeserializeStorageAccount(document.RootElement);
 496                        }
 28497                        return Response.FromValue(value, message.Response);
 498                    }
 499                default:
 2500                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 501            }
 28502        }
 503
 504        internal HttpMessage CreateListRequest()
 505        {
 4506            var message = _pipeline.CreateMessage();
 4507            var request = message.Request;
 4508            request.Method = RequestMethod.Get;
 4509            var uri = new RawRequestUriBuilder();
 4510            uri.Reset(endpoint);
 4511            uri.AppendPath("/subscriptions/", false);
 4512            uri.AppendPath(subscriptionId, true);
 4513            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts", false);
 4514            uri.AppendQuery("api-version", apiVersion, true);
 4515            request.Uri = uri;
 4516            return message;
 517        }
 518
 519        /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re
 520        /// <param name="cancellationToken"> The cancellation token to use. </param>
 521        public async Task<Response<StorageAccountListResult>> ListAsync(CancellationToken cancellationToken = default)
 522        {
 2523            using var message = CreateListRequest();
 2524            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2525            switch (message.Response.Status)
 526            {
 527                case 200:
 528                    {
 2529                        StorageAccountListResult value = default;
 2530                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2531                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 532                        {
 0533                            value = null;
 534                        }
 535                        else
 536                        {
 2537                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 538                        }
 2539                        return Response.FromValue(value, message.Response);
 540                    }
 541                default:
 0542                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 543            }
 2544        }
 545
 546        /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re
 547        /// <param name="cancellationToken"> The cancellation token to use. </param>
 548        public Response<StorageAccountListResult> List(CancellationToken cancellationToken = default)
 549        {
 2550            using var message = CreateListRequest();
 2551            _pipeline.Send(message, cancellationToken);
 2552            switch (message.Response.Status)
 553            {
 554                case 200:
 555                    {
 2556                        StorageAccountListResult value = default;
 2557                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2558                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 559                        {
 0560                            value = null;
 561                        }
 562                        else
 563                        {
 2564                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 565                        }
 2566                        return Response.FromValue(value, message.Response);
 567                    }
 568                default:
 0569                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 570            }
 2571        }
 572
 573        internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 574        {
 12575            var message = _pipeline.CreateMessage();
 12576            var request = message.Request;
 12577            request.Method = RequestMethod.Get;
 12578            var uri = new RawRequestUriBuilder();
 12579            uri.Reset(endpoint);
 12580            uri.AppendPath("/subscriptions/", false);
 12581            uri.AppendPath(subscriptionId, true);
 12582            uri.AppendPath("/resourceGroups/", false);
 12583            uri.AppendPath(resourceGroupName, true);
 12584            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts", false);
 12585            uri.AppendQuery("api-version", apiVersion, true);
 12586            request.Uri = uri;
 12587            return message;
 588        }
 589
 590        /// <summary> Lists all the storage accounts available under the given resource group. Note that storage keys ar
 591        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 592        /// <param name="cancellationToken"> The cancellation token to use. </param>
 593        public async Task<Response<StorageAccountListResult>> ListByResourceGroupAsync(string resourceGroupName, Cancell
 594        {
 6595            if (resourceGroupName == null)
 596            {
 0597                throw new ArgumentNullException(nameof(resourceGroupName));
 598            }
 599
 6600            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 6601            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6602            switch (message.Response.Status)
 603            {
 604                case 200:
 605                    {
 6606                        StorageAccountListResult value = default;
 6607                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6608                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 609                        {
 0610                            value = null;
 611                        }
 612                        else
 613                        {
 6614                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 615                        }
 6616                        return Response.FromValue(value, message.Response);
 617                    }
 618                default:
 0619                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 620            }
 6621        }
 622
 623        /// <summary> Lists all the storage accounts available under the given resource group. Note that storage keys ar
 624        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 625        /// <param name="cancellationToken"> The cancellation token to use. </param>
 626        public Response<StorageAccountListResult> ListByResourceGroup(string resourceGroupName, CancellationToken cancel
 627        {
 6628            if (resourceGroupName == null)
 629            {
 0630                throw new ArgumentNullException(nameof(resourceGroupName));
 631            }
 632
 6633            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 6634            _pipeline.Send(message, cancellationToken);
 6635            switch (message.Response.Status)
 636            {
 637                case 200:
 638                    {
 6639                        StorageAccountListResult value = default;
 6640                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6641                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 642                        {
 0643                            value = null;
 644                        }
 645                        else
 646                        {
 6647                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 648                        }
 6649                        return Response.FromValue(value, message.Response);
 650                    }
 651                default:
 0652                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 653            }
 6654        }
 655
 656        internal HttpMessage CreateListKeysRequest(string resourceGroupName, string accountName)
 657        {
 8658            var message = _pipeline.CreateMessage();
 8659            var request = message.Request;
 8660            request.Method = RequestMethod.Post;
 8661            var uri = new RawRequestUriBuilder();
 8662            uri.Reset(endpoint);
 8663            uri.AppendPath("/subscriptions/", false);
 8664            uri.AppendPath(subscriptionId, true);
 8665            uri.AppendPath("/resourceGroups/", false);
 8666            uri.AppendPath(resourceGroupName, true);
 8667            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 8668            uri.AppendPath(accountName, true);
 8669            uri.AppendPath("/listKeys", false);
 8670            uri.AppendQuery("api-version", apiVersion, true);
 8671            uri.AppendQuery("$expand", "kerb", true);
 8672            request.Uri = uri;
 8673            return message;
 674        }
 675
 676        /// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage acc
 677        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 678        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 679        /// <param name="cancellationToken"> The cancellation token to use. </param>
 680        public async Task<Response<StorageAccountListKeysResult>> ListKeysAsync(string resourceGroupName, string account
 681        {
 4682            if (resourceGroupName == null)
 683            {
 0684                throw new ArgumentNullException(nameof(resourceGroupName));
 685            }
 4686            if (accountName == null)
 687            {
 0688                throw new ArgumentNullException(nameof(accountName));
 689            }
 690
 4691            using var message = CreateListKeysRequest(resourceGroupName, accountName);
 4692            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4693            switch (message.Response.Status)
 694            {
 695                case 200:
 696                    {
 4697                        StorageAccountListKeysResult value = default;
 4698                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4699                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 700                        {
 0701                            value = null;
 702                        }
 703                        else
 704                        {
 4705                            value = StorageAccountListKeysResult.DeserializeStorageAccountListKeysResult(document.RootEl
 706                        }
 4707                        return Response.FromValue(value, message.Response);
 708                    }
 709                default:
 0710                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 711            }
 4712        }
 713
 714        /// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage acc
 715        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 716        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 717        /// <param name="cancellationToken"> The cancellation token to use. </param>
 718        public Response<StorageAccountListKeysResult> ListKeys(string resourceGroupName, string accountName, Cancellatio
 719        {
 4720            if (resourceGroupName == null)
 721            {
 0722                throw new ArgumentNullException(nameof(resourceGroupName));
 723            }
 4724            if (accountName == null)
 725            {
 0726                throw new ArgumentNullException(nameof(accountName));
 727            }
 728
 4729            using var message = CreateListKeysRequest(resourceGroupName, accountName);
 4730            _pipeline.Send(message, cancellationToken);
 4731            switch (message.Response.Status)
 732            {
 733                case 200:
 734                    {
 4735                        StorageAccountListKeysResult value = default;
 4736                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4737                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 738                        {
 0739                            value = null;
 740                        }
 741                        else
 742                        {
 4743                            value = StorageAccountListKeysResult.DeserializeStorageAccountListKeysResult(document.RootEl
 744                        }
 4745                        return Response.FromValue(value, message.Response);
 746                    }
 747                default:
 0748                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 749            }
 4750        }
 751
 752        internal HttpMessage CreateRegenerateKeyRequest(string resourceGroupName, string accountName, StorageAccountRege
 753        {
 4754            var message = _pipeline.CreateMessage();
 4755            var request = message.Request;
 4756            request.Method = RequestMethod.Post;
 4757            var uri = new RawRequestUriBuilder();
 4758            uri.Reset(endpoint);
 4759            uri.AppendPath("/subscriptions/", false);
 4760            uri.AppendPath(subscriptionId, true);
 4761            uri.AppendPath("/resourceGroups/", false);
 4762            uri.AppendPath(resourceGroupName, true);
 4763            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 4764            uri.AppendPath(accountName, true);
 4765            uri.AppendPath("/regenerateKey", false);
 4766            uri.AppendQuery("api-version", apiVersion, true);
 4767            request.Uri = uri;
 4768            request.Headers.Add("Content-Type", "application/json");
 4769            var content = new Utf8JsonRequestContent();
 4770            content.JsonWriter.WriteObjectValue(regenerateKey);
 4771            request.Content = content;
 4772            return message;
 773        }
 774
 775        /// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary>
 776        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 777        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 778        /// <param name="regenerateKey"> Specifies name of the key which should be regenerated -- key1, key2, kerb1, ker
 779        /// <param name="cancellationToken"> The cancellation token to use. </param>
 780        public async Task<Response<StorageAccountListKeysResult>> RegenerateKeyAsync(string resourceGroupName, string ac
 781        {
 2782            if (resourceGroupName == null)
 783            {
 0784                throw new ArgumentNullException(nameof(resourceGroupName));
 785            }
 2786            if (accountName == null)
 787            {
 0788                throw new ArgumentNullException(nameof(accountName));
 789            }
 2790            if (regenerateKey == null)
 791            {
 0792                throw new ArgumentNullException(nameof(regenerateKey));
 793            }
 794
 2795            using var message = CreateRegenerateKeyRequest(resourceGroupName, accountName, regenerateKey);
 2796            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2797            switch (message.Response.Status)
 798            {
 799                case 200:
 800                    {
 2801                        StorageAccountListKeysResult value = default;
 2802                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2803                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 804                        {
 0805                            value = null;
 806                        }
 807                        else
 808                        {
 2809                            value = StorageAccountListKeysResult.DeserializeStorageAccountListKeysResult(document.RootEl
 810                        }
 2811                        return Response.FromValue(value, message.Response);
 812                    }
 813                default:
 0814                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 815            }
 2816        }
 817
 818        /// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary>
 819        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 820        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 821        /// <param name="regenerateKey"> Specifies name of the key which should be regenerated -- key1, key2, kerb1, ker
 822        /// <param name="cancellationToken"> The cancellation token to use. </param>
 823        public Response<StorageAccountListKeysResult> RegenerateKey(string resourceGroupName, string accountName, Storag
 824        {
 2825            if (resourceGroupName == null)
 826            {
 0827                throw new ArgumentNullException(nameof(resourceGroupName));
 828            }
 2829            if (accountName == null)
 830            {
 0831                throw new ArgumentNullException(nameof(accountName));
 832            }
 2833            if (regenerateKey == null)
 834            {
 0835                throw new ArgumentNullException(nameof(regenerateKey));
 836            }
 837
 2838            using var message = CreateRegenerateKeyRequest(resourceGroupName, accountName, regenerateKey);
 2839            _pipeline.Send(message, cancellationToken);
 2840            switch (message.Response.Status)
 841            {
 842                case 200:
 843                    {
 2844                        StorageAccountListKeysResult value = default;
 2845                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2846                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 847                        {
 0848                            value = null;
 849                        }
 850                        else
 851                        {
 2852                            value = StorageAccountListKeysResult.DeserializeStorageAccountListKeysResult(document.RootEl
 853                        }
 2854                        return Response.FromValue(value, message.Response);
 855                    }
 856                default:
 0857                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 858            }
 2859        }
 860
 861        internal HttpMessage CreateListAccountSASRequest(string resourceGroupName, string accountName, AccountSasParamet
 862        {
 12863            var message = _pipeline.CreateMessage();
 12864            var request = message.Request;
 12865            request.Method = RequestMethod.Post;
 12866            var uri = new RawRequestUriBuilder();
 12867            uri.Reset(endpoint);
 12868            uri.AppendPath("/subscriptions/", false);
 12869            uri.AppendPath(subscriptionId, true);
 12870            uri.AppendPath("/resourceGroups/", false);
 12871            uri.AppendPath(resourceGroupName, true);
 12872            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12873            uri.AppendPath(accountName, true);
 12874            uri.AppendPath("/ListAccountSas", false);
 12875            uri.AppendQuery("api-version", apiVersion, true);
 12876            request.Uri = uri;
 12877            request.Headers.Add("Content-Type", "application/json");
 12878            var content = new Utf8JsonRequestContent();
 12879            content.JsonWriter.WriteObjectValue(parameters);
 12880            request.Content = content;
 12881            return message;
 882        }
 883
 884        /// <summary> List SAS credentials of a storage account. </summary>
 885        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 886        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 887        /// <param name="parameters"> The parameters to provide to list SAS credentials for the storage account. </param
 888        /// <param name="cancellationToken"> The cancellation token to use. </param>
 889        public async Task<Response<ListAccountSasResponse>> ListAccountSASAsync(string resourceGroupName, string account
 890        {
 6891            if (resourceGroupName == null)
 892            {
 0893                throw new ArgumentNullException(nameof(resourceGroupName));
 894            }
 6895            if (accountName == null)
 896            {
 0897                throw new ArgumentNullException(nameof(accountName));
 898            }
 6899            if (parameters == null)
 900            {
 0901                throw new ArgumentNullException(nameof(parameters));
 902            }
 903
 6904            using var message = CreateListAccountSASRequest(resourceGroupName, accountName, parameters);
 6905            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6906            switch (message.Response.Status)
 907            {
 908                case 200:
 909                    {
 4910                        ListAccountSasResponse value = default;
 4911                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4912                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 913                        {
 0914                            value = null;
 915                        }
 916                        else
 917                        {
 4918                            value = ListAccountSasResponse.DeserializeListAccountSasResponse(document.RootElement);
 919                        }
 4920                        return Response.FromValue(value, message.Response);
 921                    }
 922                default:
 2923                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 924            }
 4925        }
 926
 927        /// <summary> List SAS credentials of a storage account. </summary>
 928        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 929        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 930        /// <param name="parameters"> The parameters to provide to list SAS credentials for the storage account. </param
 931        /// <param name="cancellationToken"> The cancellation token to use. </param>
 932        public Response<ListAccountSasResponse> ListAccountSAS(string resourceGroupName, string accountName, AccountSasP
 933        {
 6934            if (resourceGroupName == null)
 935            {
 0936                throw new ArgumentNullException(nameof(resourceGroupName));
 937            }
 6938            if (accountName == null)
 939            {
 0940                throw new ArgumentNullException(nameof(accountName));
 941            }
 6942            if (parameters == null)
 943            {
 0944                throw new ArgumentNullException(nameof(parameters));
 945            }
 946
 6947            using var message = CreateListAccountSASRequest(resourceGroupName, accountName, parameters);
 6948            _pipeline.Send(message, cancellationToken);
 6949            switch (message.Response.Status)
 950            {
 951                case 200:
 952                    {
 4953                        ListAccountSasResponse value = default;
 4954                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4955                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 956                        {
 0957                            value = null;
 958                        }
 959                        else
 960                        {
 4961                            value = ListAccountSasResponse.DeserializeListAccountSasResponse(document.RootElement);
 962                        }
 4963                        return Response.FromValue(value, message.Response);
 964                    }
 965                default:
 2966                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 967            }
 4968        }
 969
 970        internal HttpMessage CreateListServiceSASRequest(string resourceGroupName, string accountName, ServiceSasParamet
 971        {
 12972            var message = _pipeline.CreateMessage();
 12973            var request = message.Request;
 12974            request.Method = RequestMethod.Post;
 12975            var uri = new RawRequestUriBuilder();
 12976            uri.Reset(endpoint);
 12977            uri.AppendPath("/subscriptions/", false);
 12978            uri.AppendPath(subscriptionId, true);
 12979            uri.AppendPath("/resourceGroups/", false);
 12980            uri.AppendPath(resourceGroupName, true);
 12981            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12982            uri.AppendPath(accountName, true);
 12983            uri.AppendPath("/ListServiceSas", false);
 12984            uri.AppendQuery("api-version", apiVersion, true);
 12985            request.Uri = uri;
 12986            request.Headers.Add("Content-Type", "application/json");
 12987            var content = new Utf8JsonRequestContent();
 12988            content.JsonWriter.WriteObjectValue(parameters);
 12989            request.Content = content;
 12990            return message;
 991        }
 992
 993        /// <summary> List service SAS credentials of a specific resource. </summary>
 994        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 995        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 996        /// <param name="parameters"> The parameters to provide to list service SAS credentials. </param>
 997        /// <param name="cancellationToken"> The cancellation token to use. </param>
 998        public async Task<Response<ListServiceSasResponse>> ListServiceSASAsync(string resourceGroupName, string account
 999        {
 61000            if (resourceGroupName == null)
 1001            {
 01002                throw new ArgumentNullException(nameof(resourceGroupName));
 1003            }
 61004            if (accountName == null)
 1005            {
 01006                throw new ArgumentNullException(nameof(accountName));
 1007            }
 61008            if (parameters == null)
 1009            {
 01010                throw new ArgumentNullException(nameof(parameters));
 1011            }
 1012
 61013            using var message = CreateListServiceSASRequest(resourceGroupName, accountName, parameters);
 61014            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 61015            switch (message.Response.Status)
 1016            {
 1017                case 200:
 1018                    {
 41019                        ListServiceSasResponse value = default;
 41020                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 41021                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1022                        {
 01023                            value = null;
 1024                        }
 1025                        else
 1026                        {
 41027                            value = ListServiceSasResponse.DeserializeListServiceSasResponse(document.RootElement);
 1028                        }
 41029                        return Response.FromValue(value, message.Response);
 1030                    }
 1031                default:
 21032                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1033            }
 41034        }
 1035
 1036        /// <summary> List service SAS credentials of a specific resource. </summary>
 1037        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1038        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1039        /// <param name="parameters"> The parameters to provide to list service SAS credentials. </param>
 1040        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1041        public Response<ListServiceSasResponse> ListServiceSAS(string resourceGroupName, string accountName, ServiceSasP
 1042        {
 61043            if (resourceGroupName == null)
 1044            {
 01045                throw new ArgumentNullException(nameof(resourceGroupName));
 1046            }
 61047            if (accountName == null)
 1048            {
 01049                throw new ArgumentNullException(nameof(accountName));
 1050            }
 61051            if (parameters == null)
 1052            {
 01053                throw new ArgumentNullException(nameof(parameters));
 1054            }
 1055
 61056            using var message = CreateListServiceSASRequest(resourceGroupName, accountName, parameters);
 61057            _pipeline.Send(message, cancellationToken);
 61058            switch (message.Response.Status)
 1059            {
 1060                case 200:
 1061                    {
 41062                        ListServiceSasResponse value = default;
 41063                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 41064                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1065                        {
 01066                            value = null;
 1067                        }
 1068                        else
 1069                        {
 41070                            value = ListServiceSasResponse.DeserializeListServiceSasResponse(document.RootElement);
 1071                        }
 41072                        return Response.FromValue(value, message.Response);
 1073                    }
 1074                default:
 21075                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1076            }
 41077        }
 1078
 1079        internal HttpMessage CreateFailoverRequest(string resourceGroupName, string accountName)
 1080        {
 01081            var message = _pipeline.CreateMessage();
 01082            var request = message.Request;
 01083            request.Method = RequestMethod.Post;
 01084            var uri = new RawRequestUriBuilder();
 01085            uri.Reset(endpoint);
 01086            uri.AppendPath("/subscriptions/", false);
 01087            uri.AppendPath(subscriptionId, true);
 01088            uri.AppendPath("/resourceGroups/", false);
 01089            uri.AppendPath(resourceGroupName, true);
 01090            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 01091            uri.AppendPath(accountName, true);
 01092            uri.AppendPath("/failover", false);
 01093            uri.AppendQuery("api-version", apiVersion, true);
 01094            request.Uri = uri;
 01095            return message;
 1096        }
 1097
 1098        /// <summary> Failover request can be triggered for a storage account in case of availability issues. The failov
 1099        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1100        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1101        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1102        public async Task<Response> FailoverAsync(string resourceGroupName, string accountName, CancellationToken cancel
 1103        {
 01104            if (resourceGroupName == null)
 1105            {
 01106                throw new ArgumentNullException(nameof(resourceGroupName));
 1107            }
 01108            if (accountName == null)
 1109            {
 01110                throw new ArgumentNullException(nameof(accountName));
 1111            }
 1112
 01113            using var message = CreateFailoverRequest(resourceGroupName, accountName);
 01114            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01115            switch (message.Response.Status)
 1116            {
 1117                case 200:
 1118                case 202:
 01119                    return message.Response;
 1120                default:
 01121                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1122            }
 01123        }
 1124
 1125        /// <summary> Failover request can be triggered for a storage account in case of availability issues. The failov
 1126        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1127        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1128        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1129        public Response Failover(string resourceGroupName, string accountName, CancellationToken cancellationToken = def
 1130        {
 01131            if (resourceGroupName == null)
 1132            {
 01133                throw new ArgumentNullException(nameof(resourceGroupName));
 1134            }
 01135            if (accountName == null)
 1136            {
 01137                throw new ArgumentNullException(nameof(accountName));
 1138            }
 1139
 01140            using var message = CreateFailoverRequest(resourceGroupName, accountName);
 01141            _pipeline.Send(message, cancellationToken);
 01142            switch (message.Response.Status)
 1143            {
 1144                case 200:
 1145                case 202:
 01146                    return message.Response;
 1147                default:
 01148                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1149            }
 01150        }
 1151
 1152        internal HttpMessage CreateRestoreBlobRangesRequest(string resourceGroupName, string accountName, BlobRestorePar
 1153        {
 01154            var message = _pipeline.CreateMessage();
 01155            var request = message.Request;
 01156            request.Method = RequestMethod.Post;
 01157            var uri = new RawRequestUriBuilder();
 01158            uri.Reset(endpoint);
 01159            uri.AppendPath("/subscriptions/", false);
 01160            uri.AppendPath(subscriptionId, true);
 01161            uri.AppendPath("/resourceGroups/", false);
 01162            uri.AppendPath(resourceGroupName, true);
 01163            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 01164            uri.AppendPath(accountName, true);
 01165            uri.AppendPath("/restoreBlobRanges", false);
 01166            uri.AppendQuery("api-version", apiVersion, true);
 01167            request.Uri = uri;
 01168            request.Headers.Add("Content-Type", "application/json");
 01169            var content = new Utf8JsonRequestContent();
 01170            content.JsonWriter.WriteObjectValue(parameters);
 01171            request.Content = content;
 01172            return message;
 1173        }
 1174
 1175        /// <summary> Restore blobs in the specified blob ranges. </summary>
 1176        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1177        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1178        /// <param name="parameters"> The parameters to provide for restore blob ranges. </param>
 1179        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1180        public async Task<Response> RestoreBlobRangesAsync(string resourceGroupName, string accountName, BlobRestorePara
 1181        {
 01182            if (resourceGroupName == null)
 1183            {
 01184                throw new ArgumentNullException(nameof(resourceGroupName));
 1185            }
 01186            if (accountName == null)
 1187            {
 01188                throw new ArgumentNullException(nameof(accountName));
 1189            }
 01190            if (parameters == null)
 1191            {
 01192                throw new ArgumentNullException(nameof(parameters));
 1193            }
 1194
 01195            using var message = CreateRestoreBlobRangesRequest(resourceGroupName, accountName, parameters);
 01196            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01197            switch (message.Response.Status)
 1198            {
 1199                case 200:
 1200                case 202:
 01201                    return message.Response;
 1202                default:
 01203                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1204            }
 01205        }
 1206
 1207        /// <summary> Restore blobs in the specified blob ranges. </summary>
 1208        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1209        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1210        /// <param name="parameters"> The parameters to provide for restore blob ranges. </param>
 1211        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1212        public Response RestoreBlobRanges(string resourceGroupName, string accountName, BlobRestoreParameters parameters
 1213        {
 01214            if (resourceGroupName == null)
 1215            {
 01216                throw new ArgumentNullException(nameof(resourceGroupName));
 1217            }
 01218            if (accountName == null)
 1219            {
 01220                throw new ArgumentNullException(nameof(accountName));
 1221            }
 01222            if (parameters == null)
 1223            {
 01224                throw new ArgumentNullException(nameof(parameters));
 1225            }
 1226
 01227            using var message = CreateRestoreBlobRangesRequest(resourceGroupName, accountName, parameters);
 01228            _pipeline.Send(message, cancellationToken);
 01229            switch (message.Response.Status)
 1230            {
 1231                case 200:
 1232                case 202:
 01233                    return message.Response;
 1234                default:
 01235                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1236            }
 01237        }
 1238
 1239        internal HttpMessage CreateRevokeUserDelegationKeysRequest(string resourceGroupName, string accountName)
 1240        {
 41241            var message = _pipeline.CreateMessage();
 41242            var request = message.Request;
 41243            request.Method = RequestMethod.Post;
 41244            var uri = new RawRequestUriBuilder();
 41245            uri.Reset(endpoint);
 41246            uri.AppendPath("/subscriptions/", false);
 41247            uri.AppendPath(subscriptionId, true);
 41248            uri.AppendPath("/resourceGroups/", false);
 41249            uri.AppendPath(resourceGroupName, true);
 41250            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 41251            uri.AppendPath(accountName, true);
 41252            uri.AppendPath("/revokeUserDelegationKeys", false);
 41253            uri.AppendQuery("api-version", apiVersion, true);
 41254            request.Uri = uri;
 41255            return message;
 1256        }
 1257
 1258        /// <summary> Revoke user delegation keys. </summary>
 1259        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1260        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1261        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1262        public async Task<Response> RevokeUserDelegationKeysAsync(string resourceGroupName, string accountName, Cancella
 1263        {
 21264            if (resourceGroupName == null)
 1265            {
 01266                throw new ArgumentNullException(nameof(resourceGroupName));
 1267            }
 21268            if (accountName == null)
 1269            {
 01270                throw new ArgumentNullException(nameof(accountName));
 1271            }
 1272
 21273            using var message = CreateRevokeUserDelegationKeysRequest(resourceGroupName, accountName);
 21274            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 21275            switch (message.Response.Status)
 1276            {
 1277                case 200:
 21278                    return message.Response;
 1279                default:
 01280                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1281            }
 21282        }
 1283
 1284        /// <summary> Revoke user delegation keys. </summary>
 1285        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 1286        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 1287        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1288        public Response RevokeUserDelegationKeys(string resourceGroupName, string accountName, CancellationToken cancell
 1289        {
 21290            if (resourceGroupName == null)
 1291            {
 01292                throw new ArgumentNullException(nameof(resourceGroupName));
 1293            }
 21294            if (accountName == null)
 1295            {
 01296                throw new ArgumentNullException(nameof(accountName));
 1297            }
 1298
 21299            using var message = CreateRevokeUserDelegationKeysRequest(resourceGroupName, accountName);
 21300            _pipeline.Send(message, cancellationToken);
 21301            switch (message.Response.Status)
 1302            {
 1303                case 200:
 21304                    return message.Response;
 1305                default:
 01306                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1307            }
 21308        }
 1309
 1310        internal HttpMessage CreateListNextPageRequest(string nextLink)
 1311        {
 01312            var message = _pipeline.CreateMessage();
 01313            var request = message.Request;
 01314            request.Method = RequestMethod.Get;
 01315            var uri = new RawRequestUriBuilder();
 01316            uri.Reset(endpoint);
 01317            uri.AppendRawNextLink(nextLink, false);
 01318            request.Uri = uri;
 01319            return message;
 1320        }
 1321
 1322        /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re
 1323        /// <param name="nextLink"> The URL to the next page of results. </param>
 1324        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1325        public async Task<Response<StorageAccountListResult>> ListNextPageAsync(string nextLink, CancellationToken cance
 1326        {
 01327            if (nextLink == null)
 1328            {
 01329                throw new ArgumentNullException(nameof(nextLink));
 1330            }
 1331
 01332            using var message = CreateListNextPageRequest(nextLink);
 01333            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 01334            switch (message.Response.Status)
 1335            {
 1336                case 200:
 1337                    {
 01338                        StorageAccountListResult value = default;
 01339                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 01340                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1341                        {
 01342                            value = null;
 1343                        }
 1344                        else
 1345                        {
 01346                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 1347                        }
 01348                        return Response.FromValue(value, message.Response);
 1349                    }
 1350                default:
 01351                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 1352            }
 01353        }
 1354
 1355        /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re
 1356        /// <param name="nextLink"> The URL to the next page of results. </param>
 1357        /// <param name="cancellationToken"> The cancellation token to use. </param>
 1358        public Response<StorageAccountListResult> ListNextPage(string nextLink, CancellationToken cancellationToken = de
 1359        {
 01360            if (nextLink == null)
 1361            {
 01362                throw new ArgumentNullException(nameof(nextLink));
 1363            }
 1364
 01365            using var message = CreateListNextPageRequest(nextLink);
 01366            _pipeline.Send(message, cancellationToken);
 01367            switch (message.Response.Status)
 1368            {
 1369                case 200:
 1370                    {
 01371                        StorageAccountListResult value = default;
 01372                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 01373                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 1374                        {
 01375                            value = null;
 1376                        }
 1377                        else
 1378                        {
 01379                            value = StorageAccountListResult.DeserializeStorageAccountListResult(document.RootElement);
 1380                        }
 01381                        return Response.FromValue(value, message.Response);
 1382                    }
 1383                default:
 01384                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 1385            }
 01386        }
 1387    }
 1388}