< Summary

Class:Azure.ResourceManager.Storage.QueueServicesRestOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\QueueServicesRestOperations.cs
Covered lines:0
Uncovered lines:157
Coverable lines:157
Total lines:354
Line coverage:0% (0 of 157)
Covered branches:0
Total branches:58
Branch coverage:0% (0 of 58)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
CreateListRequest(...)-0%100%
ListAsync()-0%0%
List(...)-0%0%
CreateSetServicePropertiesRequest(...)-0%100%
SetServicePropertiesAsync()-0%0%
SetServiceProperties(...)-0%0%
CreateGetServicePropertiesRequest(...)-0%100%
GetServicePropertiesAsync()-0%0%
GetServiceProperties(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\QueueServicesRestOperations.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 QueueServicesRestOperations
 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 QueueServicesRestOperations. </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
 034        public QueueServicesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti
 35        {
 036            if (subscriptionId == null)
 37            {
 038                throw new ArgumentNullException(nameof(subscriptionId));
 39            }
 040            endpoint ??= new Uri("https://management.azure.com");
 041            if (apiVersion == null)
 42            {
 043                throw new ArgumentNullException(nameof(apiVersion));
 44            }
 45
 046            this.subscriptionId = subscriptionId;
 047            this.endpoint = endpoint;
 048            this.apiVersion = apiVersion;
 049            _clientDiagnostics = clientDiagnostics;
 050            _pipeline = pipeline;
 051        }
 52
 53        internal HttpMessage CreateListRequest(string resourceGroupName, string accountName)
 54        {
 055            var message = _pipeline.CreateMessage();
 056            var request = message.Request;
 057            request.Method = RequestMethod.Get;
 058            var uri = new RawRequestUriBuilder();
 059            uri.Reset(endpoint);
 060            uri.AppendPath("/subscriptions/", false);
 061            uri.AppendPath(subscriptionId, true);
 062            uri.AppendPath("/resourceGroups/", false);
 063            uri.AppendPath(resourceGroupName, true);
 064            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 065            uri.AppendPath(accountName, true);
 066            uri.AppendPath("/queueServices", false);
 067            uri.AppendQuery("api-version", apiVersion, true);
 068            request.Uri = uri;
 069            return message;
 70        }
 71
 72        /// <summary> List all queue services for the storage account. </summary>
 73        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 74        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 75        /// <param name="cancellationToken"> The cancellation token to use. </param>
 76        public async Task<Response<ListQueueServices>> ListAsync(string resourceGroupName, string accountName, Cancellat
 77        {
 078            if (resourceGroupName == null)
 79            {
 080                throw new ArgumentNullException(nameof(resourceGroupName));
 81            }
 082            if (accountName == null)
 83            {
 084                throw new ArgumentNullException(nameof(accountName));
 85            }
 86
 087            using var message = CreateListRequest(resourceGroupName, accountName);
 088            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 089            switch (message.Response.Status)
 90            {
 91                case 200:
 92                    {
 093                        ListQueueServices value = default;
 094                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 095                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 96                        {
 097                            value = null;
 98                        }
 99                        else
 100                        {
 0101                            value = ListQueueServices.DeserializeListQueueServices(document.RootElement);
 102                        }
 0103                        return Response.FromValue(value, message.Response);
 104                    }
 105                default:
 0106                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 107            }
 0108        }
 109
 110        /// <summary> List all queue services for the storage account. </summary>
 111        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 112        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 113        /// <param name="cancellationToken"> The cancellation token to use. </param>
 114        public Response<ListQueueServices> List(string resourceGroupName, string accountName, CancellationToken cancella
 115        {
 0116            if (resourceGroupName == null)
 117            {
 0118                throw new ArgumentNullException(nameof(resourceGroupName));
 119            }
 0120            if (accountName == null)
 121            {
 0122                throw new ArgumentNullException(nameof(accountName));
 123            }
 124
 0125            using var message = CreateListRequest(resourceGroupName, accountName);
 0126            _pipeline.Send(message, cancellationToken);
 0127            switch (message.Response.Status)
 128            {
 129                case 200:
 130                    {
 0131                        ListQueueServices value = default;
 0132                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0133                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 134                        {
 0135                            value = null;
 136                        }
 137                        else
 138                        {
 0139                            value = ListQueueServices.DeserializeListQueueServices(document.RootElement);
 140                        }
 0141                        return Response.FromValue(value, message.Response);
 142                    }
 143                default:
 0144                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 145            }
 0146        }
 147
 148        internal HttpMessage CreateSetServicePropertiesRequest(string resourceGroupName, string accountName, QueueServic
 149        {
 0150            var message = _pipeline.CreateMessage();
 0151            var request = message.Request;
 0152            request.Method = RequestMethod.Put;
 0153            var uri = new RawRequestUriBuilder();
 0154            uri.Reset(endpoint);
 0155            uri.AppendPath("/subscriptions/", false);
 0156            uri.AppendPath(subscriptionId, true);
 0157            uri.AppendPath("/resourceGroups/", false);
 0158            uri.AppendPath(resourceGroupName, true);
 0159            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 0160            uri.AppendPath(accountName, true);
 0161            uri.AppendPath("/queueServices/", false);
 0162            uri.AppendPath("default", true);
 0163            uri.AppendQuery("api-version", apiVersion, true);
 0164            request.Uri = uri;
 0165            request.Headers.Add("Content-Type", "application/json");
 0166            var content = new Utf8JsonRequestContent();
 0167            content.JsonWriter.WriteObjectValue(parameters);
 0168            request.Content = content;
 0169            return message;
 170        }
 171
 172        /// <summary> Sets the properties of a storage account’s Queue service, including properties for Storage Analyti
 173        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 174        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 175        /// <param name="parameters"> The properties of a storage account’s Queue service, only properties for Storage A
 176        /// <param name="cancellationToken"> The cancellation token to use. </param>
 177        public async Task<Response<QueueServiceProperties>> SetServicePropertiesAsync(string resourceGroupName, string a
 178        {
 0179            if (resourceGroupName == null)
 180            {
 0181                throw new ArgumentNullException(nameof(resourceGroupName));
 182            }
 0183            if (accountName == null)
 184            {
 0185                throw new ArgumentNullException(nameof(accountName));
 186            }
 0187            if (parameters == null)
 188            {
 0189                throw new ArgumentNullException(nameof(parameters));
 190            }
 191
 0192            using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
 0193            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0194            switch (message.Response.Status)
 195            {
 196                case 200:
 197                    {
 0198                        QueueServiceProperties value = default;
 0199                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0200                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 201                        {
 0202                            value = null;
 203                        }
 204                        else
 205                        {
 0206                            value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement);
 207                        }
 0208                        return Response.FromValue(value, message.Response);
 209                    }
 210                default:
 0211                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 212            }
 0213        }
 214
 215        /// <summary> Sets the properties of a storage account’s Queue service, including properties for Storage Analyti
 216        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 217        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 218        /// <param name="parameters"> The properties of a storage account’s Queue service, only properties for Storage A
 219        /// <param name="cancellationToken"> The cancellation token to use. </param>
 220        public Response<QueueServiceProperties> SetServiceProperties(string resourceGroupName, string accountName, Queue
 221        {
 0222            if (resourceGroupName == null)
 223            {
 0224                throw new ArgumentNullException(nameof(resourceGroupName));
 225            }
 0226            if (accountName == null)
 227            {
 0228                throw new ArgumentNullException(nameof(accountName));
 229            }
 0230            if (parameters == null)
 231            {
 0232                throw new ArgumentNullException(nameof(parameters));
 233            }
 234
 0235            using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters);
 0236            _pipeline.Send(message, cancellationToken);
 0237            switch (message.Response.Status)
 238            {
 239                case 200:
 240                    {
 0241                        QueueServiceProperties value = default;
 0242                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0243                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 244                        {
 0245                            value = null;
 246                        }
 247                        else
 248                        {
 0249                            value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement);
 250                        }
 0251                        return Response.FromValue(value, message.Response);
 252                    }
 253                default:
 0254                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 255            }
 0256        }
 257
 258        internal HttpMessage CreateGetServicePropertiesRequest(string resourceGroupName, string accountName)
 259        {
 0260            var message = _pipeline.CreateMessage();
 0261            var request = message.Request;
 0262            request.Method = RequestMethod.Get;
 0263            var uri = new RawRequestUriBuilder();
 0264            uri.Reset(endpoint);
 0265            uri.AppendPath("/subscriptions/", false);
 0266            uri.AppendPath(subscriptionId, true);
 0267            uri.AppendPath("/resourceGroups/", false);
 0268            uri.AppendPath(resourceGroupName, true);
 0269            uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false);
 0270            uri.AppendPath(accountName, true);
 0271            uri.AppendPath("/queueServices/", false);
 0272            uri.AppendPath("default", true);
 0273            uri.AppendQuery("api-version", apiVersion, true);
 0274            request.Uri = uri;
 0275            return message;
 276        }
 277
 278        /// <summary> Gets the properties of a storage account’s Queue service, including properties for Storage Analyti
 279        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 280        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 281        /// <param name="cancellationToken"> The cancellation token to use. </param>
 282        public async Task<Response<QueueServiceProperties>> GetServicePropertiesAsync(string resourceGroupName, string a
 283        {
 0284            if (resourceGroupName == null)
 285            {
 0286                throw new ArgumentNullException(nameof(resourceGroupName));
 287            }
 0288            if (accountName == null)
 289            {
 0290                throw new ArgumentNullException(nameof(accountName));
 291            }
 292
 0293            using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
 0294            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0295            switch (message.Response.Status)
 296            {
 297                case 200:
 298                    {
 0299                        QueueServiceProperties value = default;
 0300                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0301                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 302                        {
 0303                            value = null;
 304                        }
 305                        else
 306                        {
 0307                            value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement);
 308                        }
 0309                        return Response.FromValue(value, message.Response);
 310                    }
 311                default:
 0312                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 313            }
 0314        }
 315
 316        /// <summary> Gets the properties of a storage account’s Queue service, including properties for Storage Analyti
 317        /// <param name="resourceGroupName"> The name of the resource group within the user&apos;s subscription. The nam
 318        /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco
 319        /// <param name="cancellationToken"> The cancellation token to use. </param>
 320        public Response<QueueServiceProperties> GetServiceProperties(string resourceGroupName, string accountName, Cance
 321        {
 0322            if (resourceGroupName == null)
 323            {
 0324                throw new ArgumentNullException(nameof(resourceGroupName));
 325            }
 0326            if (accountName == null)
 327            {
 0328                throw new ArgumentNullException(nameof(accountName));
 329            }
 330
 0331            using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName);
 0332            _pipeline.Send(message, cancellationToken);
 0333            switch (message.Response.Status)
 334            {
 335                case 200:
 336                    {
 0337                        QueueServiceProperties value = default;
 0338                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0339                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 340                        {
 0341                            value = null;
 342                        }
 343                        else
 344                        {
 0345                            value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement);
 346                        }
 0347                        return Response.FromValue(value, message.Response);
 348                    }
 349                default:
 0350                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 351            }
 0352        }
 353    }
 354}