< Summary

Class:Azure.ResourceManager.Storage.FileSharesRestOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\FileSharesRestOperations.cs
Covered lines:215
Uncovered lines:145
Coverable lines:360
Total lines:793
Line coverage:59.7% (215 of 360)
Covered branches:59
Total branches:154
Branch coverage:38.3% (59 of 154)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
CreateListRequest(...)-90%50%
ListAsync()-73.33%50%
List(...)-73.33%50%
CreateCreateRequest(...)-100%100%
CreateAsync()-68.42%50%
Create(...)-68.42%50%
CreateUpdateRequest(...)-100%100%
UpdateAsync()-68.42%50%
Update(...)-68.42%50%
CreateGetRequest(...)-100%100%
GetAsync()-70.59%50%
Get(...)-70.59%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-66.67%60%
Delete(...)-66.67%60%
CreateRestoreRequest(...)-0%100%
RestoreAsync()-0%0%
Restore(...)-0%0%
CreateListNextPageRequest(...)-0%100%
ListNextPageAsync()-0%0%
ListNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\FileSharesRestOperations.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 FileSharesRestOperations
 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 FileSharesRestOperations. </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 FileSharesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionI
 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 CreateListRequest(string resourceGroupName, string accountName, string maxpagesize, string 
 54        {
 855            var message = _pipeline.CreateMessage();
 856            var request = message.Request;
 857            request.Method = RequestMethod.Get;
 858            var uri = new RawRequestUriBuilder();
 859            uri.Reset(endpoint);
 860            uri.AppendPath("/subscriptions/", false);
 861            uri.AppendPath(subscriptionId, true);
 862            uri.AppendPath("/resourceGroups/", false);
 863            uri.AppendPath(resourceGroupName, true);
 864            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 865            uri.AppendPath(accountName, true);
 866            uri.AppendPath("/fileServices/default/shares", false);
 867            uri.AppendQuery("api-version", apiVersion, true);
 868            if (maxpagesize != null)
 69            {
 070                uri.AppendQuery("$maxpagesize", maxpagesize, true);
 71            }
 872            if (filter != null)
 73            {
 074                uri.AppendQuery("$filter", filter, true);
 75            }
 876            uri.AppendQuery("$expand", "deleted", true);
 877            request.Uri = uri;
 878            return message;
 79        }
 80
 81        /// <summary> Lists all shares. </summary>
 82        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 83        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 84        /// <param name="maxpagesize"> Optional. Specified maximum number of shares that can be included in the list. </
 85        /// <param name="filter"> Optional. When specified, only share names starting with the filter will be listed. </
 86        /// <param name="cancellationToken"> The cancellation token to use. </param>
 87        public async Task<Response<FileShareItems>> ListAsync(string resourceGroupName, string accountName, string maxpa
 88        {
 489            if (resourceGroupName == null)
 90            {
 091                throw new ArgumentNullException(nameof(resourceGroupName));
 92            }
 493            if (accountName == null)
 94            {
 095                throw new ArgumentNullException(nameof(accountName));
 96            }
 97
 498            using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
 499            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4100            switch (message.Response.Status)
 101            {
 102                case 200:
 103                    {
 4104                        FileShareItems value = default;
 4105                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4106                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 107                        {
 0108                            value = null;
 109                        }
 110                        else
 111                        {
 4112                            value = FileShareItems.DeserializeFileShareItems(document.RootElement);
 113                        }
 4114                        return Response.FromValue(value, message.Response);
 115                    }
 116                default:
 0117                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 118            }
 4119        }
 120
 121        /// <summary> Lists all shares. </summary>
 122        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 123        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 124        /// <param name="maxpagesize"> Optional. Specified maximum number of shares that can be included in the list. </
 125        /// <param name="filter"> Optional. When specified, only share names starting with the filter will be listed. </
 126        /// <param name="cancellationToken"> The cancellation token to use. </param>
 127        public Response<FileShareItems> List(string resourceGroupName, string accountName, string maxpagesize = null, st
 128        {
 4129            if (resourceGroupName == null)
 130            {
 0131                throw new ArgumentNullException(nameof(resourceGroupName));
 132            }
 4133            if (accountName == null)
 134            {
 0135                throw new ArgumentNullException(nameof(accountName));
 136            }
 137
 4138            using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter);
 4139            _pipeline.Send(message, cancellationToken);
 4140            switch (message.Response.Status)
 141            {
 142                case 200:
 143                    {
 4144                        FileShareItems value = default;
 4145                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4146                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 147                        {
 0148                            value = null;
 149                        }
 150                        else
 151                        {
 4152                            value = FileShareItems.DeserializeFileShareItems(document.RootElement);
 153                        }
 4154                        return Response.FromValue(value, message.Response);
 155                    }
 156                default:
 0157                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 158            }
 4159        }
 160
 161        internal HttpMessage CreateCreateRequest(string resourceGroupName, string accountName, string shareName, FileSha
 162        {
 12163            var message = _pipeline.CreateMessage();
 12164            var request = message.Request;
 12165            request.Method = RequestMethod.Put;
 12166            var uri = new RawRequestUriBuilder();
 12167            uri.Reset(endpoint);
 12168            uri.AppendPath("/subscriptions/", false);
 12169            uri.AppendPath(subscriptionId, true);
 12170            uri.AppendPath("/resourceGroups/", false);
 12171            uri.AppendPath(resourceGroupName, true);
 12172            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12173            uri.AppendPath(accountName, true);
 12174            uri.AppendPath("/fileServices/default/shares/", false);
 12175            uri.AppendPath(shareName, true);
 12176            uri.AppendQuery("api-version", apiVersion, true);
 12177            request.Uri = uri;
 12178            request.Headers.Add("Content-Type", "application/json");
 12179            var content = new Utf8JsonRequestContent();
 12180            content.JsonWriter.WriteObjectValue(fileShare);
 12181            request.Content = content;
 12182            return message;
 183        }
 184
 185        /// <summary> Creates a new share under the specified account as described by request body. The share resource i
 186        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 187        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 188        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 189        /// <param name="fileShare"> Properties of the file share to create. </param>
 190        /// <param name="cancellationToken"> The cancellation token to use. </param>
 191        public async Task<Response<FileShare>> CreateAsync(string resourceGroupName, string accountName, string shareNam
 192        {
 6193            if (resourceGroupName == null)
 194            {
 0195                throw new ArgumentNullException(nameof(resourceGroupName));
 196            }
 6197            if (accountName == null)
 198            {
 0199                throw new ArgumentNullException(nameof(accountName));
 200            }
 6201            if (shareName == null)
 202            {
 0203                throw new ArgumentNullException(nameof(shareName));
 204            }
 6205            if (fileShare == null)
 206            {
 0207                throw new ArgumentNullException(nameof(fileShare));
 208            }
 209
 6210            using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
 6211            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6212            switch (message.Response.Status)
 213            {
 214                case 200:
 215                case 201:
 216                    {
 6217                        FileShare value = default;
 6218                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6219                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 220                        {
 0221                            value = null;
 222                        }
 223                        else
 224                        {
 6225                            value = FileShare.DeserializeFileShare(document.RootElement);
 226                        }
 6227                        return Response.FromValue(value, message.Response);
 228                    }
 229                default:
 0230                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 231            }
 6232        }
 233
 234        /// <summary> Creates a new share under the specified account as described by request body. The share resource i
 235        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 236        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 237        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 238        /// <param name="fileShare"> Properties of the file share to create. </param>
 239        /// <param name="cancellationToken"> The cancellation token to use. </param>
 240        public Response<FileShare> Create(string resourceGroupName, string accountName, string shareName, FileShare file
 241        {
 6242            if (resourceGroupName == null)
 243            {
 0244                throw new ArgumentNullException(nameof(resourceGroupName));
 245            }
 6246            if (accountName == null)
 247            {
 0248                throw new ArgumentNullException(nameof(accountName));
 249            }
 6250            if (shareName == null)
 251            {
 0252                throw new ArgumentNullException(nameof(shareName));
 253            }
 6254            if (fileShare == null)
 255            {
 0256                throw new ArgumentNullException(nameof(fileShare));
 257            }
 258
 6259            using var message = CreateCreateRequest(resourceGroupName, accountName, shareName, fileShare);
 6260            _pipeline.Send(message, cancellationToken);
 6261            switch (message.Response.Status)
 262            {
 263                case 200:
 264                case 201:
 265                    {
 6266                        FileShare value = default;
 6267                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6268                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 269                        {
 0270                            value = null;
 271                        }
 272                        else
 273                        {
 6274                            value = FileShare.DeserializeFileShare(document.RootElement);
 275                        }
 6276                        return Response.FromValue(value, message.Response);
 277                    }
 278                default:
 0279                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 280            }
 6281        }
 282
 283        internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accountName, string shareName, FileSha
 284        {
 4285            var message = _pipeline.CreateMessage();
 4286            var request = message.Request;
 4287            request.Method = RequestMethod.Patch;
 4288            var uri = new RawRequestUriBuilder();
 4289            uri.Reset(endpoint);
 4290            uri.AppendPath("/subscriptions/", false);
 4291            uri.AppendPath(subscriptionId, true);
 4292            uri.AppendPath("/resourceGroups/", false);
 4293            uri.AppendPath(resourceGroupName, true);
 4294            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 4295            uri.AppendPath(accountName, true);
 4296            uri.AppendPath("/fileServices/default/shares/", false);
 4297            uri.AppendPath(shareName, true);
 4298            uri.AppendQuery("api-version", apiVersion, true);
 4299            request.Uri = uri;
 4300            request.Headers.Add("Content-Type", "application/json");
 4301            var content = new Utf8JsonRequestContent();
 4302            content.JsonWriter.WriteObjectValue(fileShare);
 4303            request.Content = content;
 4304            return message;
 305        }
 306
 307        /// <summary> Updates share properties as specified in request body. Properties not mentioned in the request wil
 308        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 309        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 310        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 311        /// <param name="fileShare"> Properties to update for the file share. </param>
 312        /// <param name="cancellationToken"> The cancellation token to use. </param>
 313        public async Task<Response<FileShare>> UpdateAsync(string resourceGroupName, string accountName, string shareNam
 314        {
 2315            if (resourceGroupName == null)
 316            {
 0317                throw new ArgumentNullException(nameof(resourceGroupName));
 318            }
 2319            if (accountName == null)
 320            {
 0321                throw new ArgumentNullException(nameof(accountName));
 322            }
 2323            if (shareName == null)
 324            {
 0325                throw new ArgumentNullException(nameof(shareName));
 326            }
 2327            if (fileShare == null)
 328            {
 0329                throw new ArgumentNullException(nameof(fileShare));
 330            }
 331
 2332            using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
 2333            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2334            switch (message.Response.Status)
 335            {
 336                case 200:
 337                    {
 2338                        FileShare value = default;
 2339                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2340                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 341                        {
 0342                            value = null;
 343                        }
 344                        else
 345                        {
 2346                            value = FileShare.DeserializeFileShare(document.RootElement);
 347                        }
 2348                        return Response.FromValue(value, message.Response);
 349                    }
 350                default:
 0351                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 352            }
 2353        }
 354
 355        /// <summary> Updates share properties as specified in request body. Properties not mentioned in the request wil
 356        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 357        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 358        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 359        /// <param name="fileShare"> Properties to update for the file share. </param>
 360        /// <param name="cancellationToken"> The cancellation token to use. </param>
 361        public Response<FileShare> Update(string resourceGroupName, string accountName, string shareName, FileShare file
 362        {
 2363            if (resourceGroupName == null)
 364            {
 0365                throw new ArgumentNullException(nameof(resourceGroupName));
 366            }
 2367            if (accountName == null)
 368            {
 0369                throw new ArgumentNullException(nameof(accountName));
 370            }
 2371            if (shareName == null)
 372            {
 0373                throw new ArgumentNullException(nameof(shareName));
 374            }
 2375            if (fileShare == null)
 376            {
 0377                throw new ArgumentNullException(nameof(fileShare));
 378            }
 379
 2380            using var message = CreateUpdateRequest(resourceGroupName, accountName, shareName, fileShare);
 2381            _pipeline.Send(message, cancellationToken);
 2382            switch (message.Response.Status)
 383            {
 384                case 200:
 385                    {
 2386                        FileShare value = default;
 2387                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2388                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 389                        {
 0390                            value = null;
 391                        }
 392                        else
 393                        {
 2394                            value = FileShare.DeserializeFileShare(document.RootElement);
 395                        }
 2396                        return Response.FromValue(value, message.Response);
 397                    }
 398                default:
 0399                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 400            }
 2401        }
 402
 403        internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string shareName)
 404        {
 12405            var message = _pipeline.CreateMessage();
 12406            var request = message.Request;
 12407            request.Method = RequestMethod.Get;
 12408            var uri = new RawRequestUriBuilder();
 12409            uri.Reset(endpoint);
 12410            uri.AppendPath("/subscriptions/", false);
 12411            uri.AppendPath(subscriptionId, true);
 12412            uri.AppendPath("/resourceGroups/", false);
 12413            uri.AppendPath(resourceGroupName, true);
 12414            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12415            uri.AppendPath(accountName, true);
 12416            uri.AppendPath("/fileServices/default/shares/", false);
 12417            uri.AppendPath(shareName, true);
 12418            uri.AppendQuery("api-version", apiVersion, true);
 12419            uri.AppendQuery("$expand", "stats", true);
 12420            request.Uri = uri;
 12421            return message;
 422        }
 423
 424        /// <summary> Gets properties of a specified share. </summary>
 425        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 426        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 427        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 428        /// <param name="cancellationToken"> The cancellation token to use. </param>
 429        public async Task<Response<FileShare>> GetAsync(string resourceGroupName, string accountName, string shareName, 
 430        {
 6431            if (resourceGroupName == null)
 432            {
 0433                throw new ArgumentNullException(nameof(resourceGroupName));
 434            }
 6435            if (accountName == null)
 436            {
 0437                throw new ArgumentNullException(nameof(accountName));
 438            }
 6439            if (shareName == null)
 440            {
 0441                throw new ArgumentNullException(nameof(shareName));
 442            }
 443
 6444            using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
 6445            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6446            switch (message.Response.Status)
 447            {
 448                case 200:
 449                    {
 6450                        FileShare value = default;
 6451                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 6452                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 453                        {
 0454                            value = null;
 455                        }
 456                        else
 457                        {
 6458                            value = FileShare.DeserializeFileShare(document.RootElement);
 459                        }
 6460                        return Response.FromValue(value, message.Response);
 461                    }
 462                default:
 0463                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 464            }
 6465        }
 466
 467        /// <summary> Gets properties of a specified share. </summary>
 468        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 469        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 470        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 471        /// <param name="cancellationToken"> The cancellation token to use. </param>
 472        public Response<FileShare> Get(string resourceGroupName, string accountName, string shareName, CancellationToken
 473        {
 6474            if (resourceGroupName == null)
 475            {
 0476                throw new ArgumentNullException(nameof(resourceGroupName));
 477            }
 6478            if (accountName == null)
 479            {
 0480                throw new ArgumentNullException(nameof(accountName));
 481            }
 6482            if (shareName == null)
 483            {
 0484                throw new ArgumentNullException(nameof(shareName));
 485            }
 486
 6487            using var message = CreateGetRequest(resourceGroupName, accountName, shareName);
 6488            _pipeline.Send(message, cancellationToken);
 6489            switch (message.Response.Status)
 490            {
 491                case 200:
 492                    {
 6493                        FileShare value = default;
 6494                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 6495                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 496                        {
 0497                            value = null;
 498                        }
 499                        else
 500                        {
 6501                            value = FileShare.DeserializeFileShare(document.RootElement);
 502                        }
 6503                        return Response.FromValue(value, message.Response);
 504                    }
 505                default:
 0506                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 507            }
 6508        }
 509
 510        internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, string shareName)
 511        {
 12512            var message = _pipeline.CreateMessage();
 12513            var request = message.Request;
 12514            request.Method = RequestMethod.Delete;
 12515            var uri = new RawRequestUriBuilder();
 12516            uri.Reset(endpoint);
 12517            uri.AppendPath("/subscriptions/", false);
 12518            uri.AppendPath(subscriptionId, true);
 12519            uri.AppendPath("/resourceGroups/", false);
 12520            uri.AppendPath(resourceGroupName, true);
 12521            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 12522            uri.AppendPath(accountName, true);
 12523            uri.AppendPath("/fileServices/default/shares/", false);
 12524            uri.AppendPath(shareName, true);
 12525            uri.AppendQuery("api-version", apiVersion, true);
 12526            request.Uri = uri;
 12527            return message;
 528        }
 529
 530        /// <summary> Deletes specified share under its account. </summary>
 531        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 532        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 533        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 534        /// <param name="cancellationToken"> The cancellation token to use. </param>
 535        public async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string shareName, Cancella
 536        {
 6537            if (resourceGroupName == null)
 538            {
 0539                throw new ArgumentNullException(nameof(resourceGroupName));
 540            }
 6541            if (accountName == null)
 542            {
 0543                throw new ArgumentNullException(nameof(accountName));
 544            }
 6545            if (shareName == null)
 546            {
 0547                throw new ArgumentNullException(nameof(shareName));
 548            }
 549
 6550            using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
 6551            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6552            switch (message.Response.Status)
 553            {
 554                case 200:
 555                case 204:
 6556                    return message.Response;
 557                default:
 0558                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 559            }
 6560        }
 561
 562        /// <summary> Deletes specified share under its account. </summary>
 563        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 564        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 565        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 566        /// <param name="cancellationToken"> The cancellation token to use. </param>
 567        public Response Delete(string resourceGroupName, string accountName, string shareName, CancellationToken cancell
 568        {
 6569            if (resourceGroupName == null)
 570            {
 0571                throw new ArgumentNullException(nameof(resourceGroupName));
 572            }
 6573            if (accountName == null)
 574            {
 0575                throw new ArgumentNullException(nameof(accountName));
 576            }
 6577            if (shareName == null)
 578            {
 0579                throw new ArgumentNullException(nameof(shareName));
 580            }
 581
 6582            using var message = CreateDeleteRequest(resourceGroupName, accountName, shareName);
 6583            _pipeline.Send(message, cancellationToken);
 6584            switch (message.Response.Status)
 585            {
 586                case 200:
 587                case 204:
 6588                    return message.Response;
 589                default:
 0590                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 591            }
 6592        }
 593
 594        internal HttpMessage CreateRestoreRequest(string resourceGroupName, string accountName, string shareName, Delete
 595        {
 0596            var message = _pipeline.CreateMessage();
 0597            var request = message.Request;
 0598            request.Method = RequestMethod.Post;
 0599            var uri = new RawRequestUriBuilder();
 0600            uri.Reset(endpoint);
 0601            uri.AppendPath("/subscriptions/", false);
 0602            uri.AppendPath(subscriptionId, true);
 0603            uri.AppendPath("/resourceGroups/", false);
 0604            uri.AppendPath(resourceGroupName, true);
 0605            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 0606            uri.AppendPath(accountName, true);
 0607            uri.AppendPath("/fileServices/default/shares/", false);
 0608            uri.AppendPath(shareName, true);
 0609            uri.AppendPath("/restore", false);
 0610            uri.AppendQuery("api-version", apiVersion, true);
 0611            request.Uri = uri;
 0612            request.Headers.Add("Content-Type", "application/json");
 0613            var content = new Utf8JsonRequestContent();
 0614            content.JsonWriter.WriteObjectValue(deletedShare);
 0615            request.Content = content;
 0616            return message;
 617        }
 618
 619        /// <summary> Restore a file share within a valid retention days if share soft delete is enabled. </summary>
 620        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 621        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 622        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 623        /// <param name="deletedShare"> The DeletedShare to use. </param>
 624        /// <param name="cancellationToken"> The cancellation token to use. </param>
 625        public async Task<Response> RestoreAsync(string resourceGroupName, string accountName, string shareName, Deleted
 626        {
 0627            if (resourceGroupName == null)
 628            {
 0629                throw new ArgumentNullException(nameof(resourceGroupName));
 630            }
 0631            if (accountName == null)
 632            {
 0633                throw new ArgumentNullException(nameof(accountName));
 634            }
 0635            if (shareName == null)
 636            {
 0637                throw new ArgumentNullException(nameof(shareName));
 638            }
 0639            if (deletedShare == null)
 640            {
 0641                throw new ArgumentNullException(nameof(deletedShare));
 642            }
 643
 0644            using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShare);
 0645            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0646            switch (message.Response.Status)
 647            {
 648                case 200:
 0649                    return message.Response;
 650                default:
 0651                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 652            }
 0653        }
 654
 655        /// <summary> Restore a file share within a valid retention days if share soft delete is enabled. </summary>
 656        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 657        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 658        /// <param name="shareName"> The name of the file share within the specified storage account. File share names m
 659        /// <param name="deletedShare"> The DeletedShare to use. </param>
 660        /// <param name="cancellationToken"> The cancellation token to use. </param>
 661        public Response Restore(string resourceGroupName, string accountName, string shareName, DeletedShare deletedShar
 662        {
 0663            if (resourceGroupName == null)
 664            {
 0665                throw new ArgumentNullException(nameof(resourceGroupName));
 666            }
 0667            if (accountName == null)
 668            {
 0669                throw new ArgumentNullException(nameof(accountName));
 670            }
 0671            if (shareName == null)
 672            {
 0673                throw new ArgumentNullException(nameof(shareName));
 674            }
 0675            if (deletedShare == null)
 676            {
 0677                throw new ArgumentNullException(nameof(deletedShare));
 678            }
 679
 0680            using var message = CreateRestoreRequest(resourceGroupName, accountName, shareName, deletedShare);
 0681            _pipeline.Send(message, cancellationToken);
 0682            switch (message.Response.Status)
 683            {
 684                case 200:
 0685                    return message.Response;
 686                default:
 0687                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 688            }
 0689        }
 690
 691        internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string accountName, st
 692        {
 0693            var message = _pipeline.CreateMessage();
 0694            var request = message.Request;
 0695            request.Method = RequestMethod.Get;
 0696            var uri = new RawRequestUriBuilder();
 0697            uri.Reset(endpoint);
 0698            uri.AppendRawNextLink(nextLink, false);
 0699            request.Uri = uri;
 0700            return message;
 701        }
 702
 703        /// <summary> Lists all shares. </summary>
 704        /// <param name="nextLink"> The URL to the next page of results. </param>
 705        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 706        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 707        /// <param name="maxpagesize"> Optional. Specified maximum number of shares that can be included in the list. </
 708        /// <param name="filter"> Optional. When specified, only share names starting with the filter will be listed. </
 709        /// <param name="cancellationToken"> The cancellation token to use. </param>
 710        public async Task<Response<FileShareItems>> ListNextPageAsync(string nextLink, string resourceGroupName, string 
 711        {
 0712            if (nextLink == null)
 713            {
 0714                throw new ArgumentNullException(nameof(nextLink));
 715            }
 0716            if (resourceGroupName == null)
 717            {
 0718                throw new ArgumentNullException(nameof(resourceGroupName));
 719            }
 0720            if (accountName == null)
 721            {
 0722                throw new ArgumentNullException(nameof(accountName));
 723            }
 724
 0725            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter)
 0726            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0727            switch (message.Response.Status)
 728            {
 729                case 200:
 730                    {
 0731                        FileShareItems value = default;
 0732                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0733                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 734                        {
 0735                            value = null;
 736                        }
 737                        else
 738                        {
 0739                            value = FileShareItems.DeserializeFileShareItems(document.RootElement);
 740                        }
 0741                        return Response.FromValue(value, message.Response);
 742                    }
 743                default:
 0744                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 745            }
 0746        }
 747
 748        /// <summary> Lists all shares. </summary>
 749        /// <param name="nextLink"> The URL to the next page of results. </param>
 750        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 751        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 752        /// <param name="maxpagesize"> Optional. Specified maximum number of shares that can be included in the list. </
 753        /// <param name="filter"> Optional. When specified, only share names starting with the filter will be listed. </
 754        /// <param name="cancellationToken"> The cancellation token to use. </param>
 755        public Response<FileShareItems> ListNextPage(string nextLink, string resourceGroupName, string accountName, stri
 756        {
 0757            if (nextLink == null)
 758            {
 0759                throw new ArgumentNullException(nameof(nextLink));
 760            }
 0761            if (resourceGroupName == null)
 762            {
 0763                throw new ArgumentNullException(nameof(resourceGroupName));
 764            }
 0765            if (accountName == null)
 766            {
 0767                throw new ArgumentNullException(nameof(accountName));
 768            }
 769
 0770            using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter)
 0771            _pipeline.Send(message, cancellationToken);
 0772            switch (message.Response.Status)
 773            {
 774                case 200:
 775                    {
 0776                        FileShareItems value = default;
 0777                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0778                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 779                        {
 0780                            value = null;
 781                        }
 782                        else
 783                        {
 0784                            value = FileShareItems.DeserializeFileShareItems(document.RootElement);
 785                        }
 0786                        return Response.FromValue(value, message.Response);
 787                    }
 788                default:
 0789                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 790            }
 0791        }
 792    }
 793}