< Summary

Class:Azure.ResourceManager.Resources.DeploymentScriptsRestOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\DeploymentScriptsRestOperations.cs
Covered lines:206
Uncovered lines:208
Coverable lines:414
Total lines:915
Line coverage:49.7% (206 of 414)
Covered branches:45
Total branches:152
Branch coverage:29.6% (45 of 152)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-88.89%50%
CreateCreateRequest(...)-100%100%
CreateAsync()-66.67%50%
Create(...)-66.67%50%
CreateUpdateRequest(...)-0%0%
UpdateAsync()-0%0%
Update(...)-0%0%
CreateGetRequest(...)-100%100%
GetAsync()-73.33%50%
Get(...)-73.33%50%
CreateDeleteRequest(...)-100%100%
DeleteAsync()-70%50%
Delete(...)-70%50%
CreateListBySubscriptionRequest()-100%100%
ListBySubscriptionAsync()-81.82%50%
ListBySubscription(...)-81.82%50%
CreateGetLogsRequest(...)-0%100%
GetLogsAsync()-0%0%
GetLogs(...)-0%0%
CreateGetLogsDefaultRequest(...)-94.12%50%
GetLogsDefaultAsync()-73.33%50%
GetLogsDefault(...)-73.33%50%
CreateListByResourceGroupRequest(...)-100%100%
ListByResourceGroupAsync()-76.92%50%
ListByResourceGroup(...)-76.92%50%
CreateListBySubscriptionNextPageRequest(...)-0%100%
ListBySubscriptionNextPageAsync()-0%0%
ListBySubscriptionNextPage(...)-0%0%
CreateListByResourceGroupNextPageRequest(...)-0%100%
ListByResourceGroupNextPageAsync()-0%0%
ListByResourceGroupNextPage(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\DeploymentScriptsRestOperations.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.Resources.Models;
 16
 17namespace Azure.ResourceManager.Resources
 18{
 19    internal partial class DeploymentScriptsRestOperations
 20    {
 21        private string subscriptionId;
 22        private Uri endpoint;
 23        private ClientDiagnostics _clientDiagnostics;
 24        private HttpPipeline _pipeline;
 25
 26        /// <summary> Initializes a new instance of DeploymentScriptsRestOperations. </summary>
 27        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 28        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 29        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 30        /// <param name="endpoint"> server parameter. </param>
 31        /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception
 25632        public DeploymentScriptsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscr
 33        {
 25634            if (subscriptionId == null)
 35            {
 036                throw new ArgumentNullException(nameof(subscriptionId));
 37            }
 25638            endpoint ??= new Uri("https://management.azure.com");
 39
 25640            this.subscriptionId = subscriptionId;
 25641            this.endpoint = endpoint;
 25642            _clientDiagnostics = clientDiagnostics;
 25643            _pipeline = pipeline;
 25644        }
 45
 46        internal Core.HttpMessage CreateCreateRequest(string resourceGroupName, string scriptName, DeploymentScript depl
 47        {
 2448            var message = _pipeline.CreateMessage();
 2449            var request = message.Request;
 2450            request.Method = RequestMethod.Put;
 2451            var uri = new RawRequestUriBuilder();
 2452            uri.Reset(endpoint);
 2453            uri.AppendPath("/subscriptions/", false);
 2454            uri.AppendPath(subscriptionId, true);
 2455            uri.AppendPath("/resourcegroups/", false);
 2456            uri.AppendPath(resourceGroupName, true);
 2457            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 2458            uri.AppendPath(scriptName, true);
 2459            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 2460            request.Uri = uri;
 2461            request.Headers.Add("Content-Type", "application/json");
 2462            var content = new Utf8JsonRequestContent();
 2463            content.JsonWriter.WriteObjectValue(deploymentScript);
 2464            request.Content = content;
 2465            return message;
 66        }
 67
 68        /// <summary> Creates a deployment script. </summary>
 69        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 70        /// <param name="scriptName"> Name of the deployment script. </param>
 71        /// <param name="deploymentScript"> Deployment script supplied to the operation. </param>
 72        /// <param name="cancellationToken"> The cancellation token to use. </param>
 73        public async Task<Response> CreateAsync(string resourceGroupName, string scriptName, DeploymentScript deployment
 74        {
 675            if (resourceGroupName == null)
 76            {
 077                throw new ArgumentNullException(nameof(resourceGroupName));
 78            }
 679            if (scriptName == null)
 80            {
 081                throw new ArgumentNullException(nameof(scriptName));
 82            }
 683            if (deploymentScript == null)
 84            {
 085                throw new ArgumentNullException(nameof(deploymentScript));
 86            }
 87
 688            using var message = CreateCreateRequest(resourceGroupName, scriptName, deploymentScript);
 689            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 690            switch (message.Response.Status)
 91            {
 92                case 200:
 93                case 201:
 694                    return message.Response;
 95                default:
 096                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 97            }
 698        }
 99
 100        /// <summary> Creates a deployment script. </summary>
 101        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 102        /// <param name="scriptName"> Name of the deployment script. </param>
 103        /// <param name="deploymentScript"> Deployment script supplied to the operation. </param>
 104        /// <param name="cancellationToken"> The cancellation token to use. </param>
 105        public Response Create(string resourceGroupName, string scriptName, DeploymentScript deploymentScript, Cancellat
 106        {
 6107            if (resourceGroupName == null)
 108            {
 0109                throw new ArgumentNullException(nameof(resourceGroupName));
 110            }
 6111            if (scriptName == null)
 112            {
 0113                throw new ArgumentNullException(nameof(scriptName));
 114            }
 6115            if (deploymentScript == null)
 116            {
 0117                throw new ArgumentNullException(nameof(deploymentScript));
 118            }
 119
 6120            using var message = CreateCreateRequest(resourceGroupName, scriptName, deploymentScript);
 6121            _pipeline.Send(message, cancellationToken);
 6122            switch (message.Response.Status)
 123            {
 124                case 200:
 125                case 201:
 6126                    return message.Response;
 127                default:
 0128                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 129            }
 6130        }
 131
 132        internal Core.HttpMessage CreateUpdateRequest(string resourceGroupName, string scriptName, DeploymentScriptUpdat
 133        {
 0134            var message = _pipeline.CreateMessage();
 0135            var request = message.Request;
 0136            request.Method = RequestMethod.Patch;
 0137            var uri = new RawRequestUriBuilder();
 0138            uri.Reset(endpoint);
 0139            uri.AppendPath("/subscriptions/", false);
 0140            uri.AppendPath(subscriptionId, true);
 0141            uri.AppendPath("/resourcegroups/", false);
 0142            uri.AppendPath(resourceGroupName, true);
 0143            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 0144            uri.AppendPath(scriptName, true);
 0145            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 0146            request.Uri = uri;
 0147            request.Headers.Add("Content-Type", "application/json");
 0148            if (deploymentScript != null)
 149            {
 0150                var content = new Utf8JsonRequestContent();
 0151                content.JsonWriter.WriteObjectValue(deploymentScript);
 0152                request.Content = content;
 153            }
 0154            return message;
 155        }
 156
 157        /// <summary> Updates deployment script tags with specified values. </summary>
 158        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 159        /// <param name="scriptName"> Name of the deployment script. </param>
 160        /// <param name="deploymentScript"> Deployment script resource with the tags to be updated. </param>
 161        /// <param name="cancellationToken"> The cancellation token to use. </param>
 162        public async Task<Response<DeploymentScript>> UpdateAsync(string resourceGroupName, string scriptName, Deploymen
 163        {
 0164            if (resourceGroupName == null)
 165            {
 0166                throw new ArgumentNullException(nameof(resourceGroupName));
 167            }
 0168            if (scriptName == null)
 169            {
 0170                throw new ArgumentNullException(nameof(scriptName));
 171            }
 172
 0173            using var message = CreateUpdateRequest(resourceGroupName, scriptName, deploymentScript);
 0174            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0175            switch (message.Response.Status)
 176            {
 177                case 200:
 178                    {
 0179                        DeploymentScript value = default;
 0180                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0181                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 182                        {
 0183                            value = null;
 184                        }
 185                        else
 186                        {
 0187                            value = DeploymentScript.DeserializeDeploymentScript(document.RootElement);
 188                        }
 0189                        return Response.FromValue(value, message.Response);
 190                    }
 191                default:
 0192                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 193            }
 0194        }
 195
 196        /// <summary> Updates deployment script tags with specified values. </summary>
 197        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 198        /// <param name="scriptName"> Name of the deployment script. </param>
 199        /// <param name="deploymentScript"> Deployment script resource with the tags to be updated. </param>
 200        /// <param name="cancellationToken"> The cancellation token to use. </param>
 201        public Response<DeploymentScript> Update(string resourceGroupName, string scriptName, DeploymentScriptUpdatePara
 202        {
 0203            if (resourceGroupName == null)
 204            {
 0205                throw new ArgumentNullException(nameof(resourceGroupName));
 206            }
 0207            if (scriptName == null)
 208            {
 0209                throw new ArgumentNullException(nameof(scriptName));
 210            }
 211
 0212            using var message = CreateUpdateRequest(resourceGroupName, scriptName, deploymentScript);
 0213            _pipeline.Send(message, cancellationToken);
 0214            switch (message.Response.Status)
 215            {
 216                case 200:
 217                    {
 0218                        DeploymentScript value = default;
 0219                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0220                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 221                        {
 0222                            value = null;
 223                        }
 224                        else
 225                        {
 0226                            value = DeploymentScript.DeserializeDeploymentScript(document.RootElement);
 227                        }
 0228                        return Response.FromValue(value, message.Response);
 229                    }
 230                default:
 0231                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 232            }
 0233        }
 234
 235        internal Core.HttpMessage CreateGetRequest(string resourceGroupName, string scriptName)
 236        {
 46237            var message = _pipeline.CreateMessage();
 46238            var request = message.Request;
 46239            request.Method = RequestMethod.Get;
 46240            var uri = new RawRequestUriBuilder();
 46241            uri.Reset(endpoint);
 46242            uri.AppendPath("/subscriptions/", false);
 46243            uri.AppendPath(subscriptionId, true);
 46244            uri.AppendPath("/resourcegroups/", false);
 46245            uri.AppendPath(resourceGroupName, true);
 46246            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 46247            uri.AppendPath(scriptName, true);
 46248            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 46249            request.Uri = uri;
 46250            return message;
 251        }
 252
 253        /// <summary> Gets a deployment script with a given name. </summary>
 254        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 255        /// <param name="scriptName"> Name of the deployment script. </param>
 256        /// <param name="cancellationToken"> The cancellation token to use. </param>
 257        public async Task<Response<DeploymentScript>> GetAsync(string resourceGroupName, string scriptName, Cancellation
 258        {
 24259            if (resourceGroupName == null)
 260            {
 0261                throw new ArgumentNullException(nameof(resourceGroupName));
 262            }
 24263            if (scriptName == null)
 264            {
 0265                throw new ArgumentNullException(nameof(scriptName));
 266            }
 267
 24268            using var message = CreateGetRequest(resourceGroupName, scriptName);
 24269            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 24270            switch (message.Response.Status)
 271            {
 272                case 200:
 273                    {
 24274                        DeploymentScript value = default;
 24275                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 24276                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 277                        {
 0278                            value = null;
 279                        }
 280                        else
 281                        {
 24282                            value = DeploymentScript.DeserializeDeploymentScript(document.RootElement);
 283                        }
 24284                        return Response.FromValue(value, message.Response);
 285                    }
 286                default:
 0287                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 288            }
 24289        }
 290
 291        /// <summary> Gets a deployment script with a given name. </summary>
 292        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 293        /// <param name="scriptName"> Name of the deployment script. </param>
 294        /// <param name="cancellationToken"> The cancellation token to use. </param>
 295        public Response<DeploymentScript> Get(string resourceGroupName, string scriptName, CancellationToken cancellatio
 296        {
 22297            if (resourceGroupName == null)
 298            {
 0299                throw new ArgumentNullException(nameof(resourceGroupName));
 300            }
 22301            if (scriptName == null)
 302            {
 0303                throw new ArgumentNullException(nameof(scriptName));
 304            }
 305
 22306            using var message = CreateGetRequest(resourceGroupName, scriptName);
 22307            _pipeline.Send(message, cancellationToken);
 22308            switch (message.Response.Status)
 309            {
 310                case 200:
 311                    {
 22312                        DeploymentScript value = default;
 22313                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 22314                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 315                        {
 0316                            value = null;
 317                        }
 318                        else
 319                        {
 22320                            value = DeploymentScript.DeserializeDeploymentScript(document.RootElement);
 321                        }
 22322                        return Response.FromValue(value, message.Response);
 323                    }
 324                default:
 0325                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 326            }
 22327        }
 328
 329        internal Core.HttpMessage CreateDeleteRequest(string resourceGroupName, string scriptName)
 330        {
 12331            var message = _pipeline.CreateMessage();
 12332            var request = message.Request;
 12333            request.Method = RequestMethod.Delete;
 12334            var uri = new RawRequestUriBuilder();
 12335            uri.Reset(endpoint);
 12336            uri.AppendPath("/subscriptions/", false);
 12337            uri.AppendPath(subscriptionId, true);
 12338            uri.AppendPath("/resourcegroups/", false);
 12339            uri.AppendPath(resourceGroupName, true);
 12340            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 12341            uri.AppendPath(scriptName, true);
 12342            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 12343            request.Uri = uri;
 12344            return message;
 345        }
 346
 347        /// <summary> Deletes a deployment script. When operation completes, status code 200 returned without content. <
 348        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 349        /// <param name="scriptName"> Name of the deployment script. </param>
 350        /// <param name="cancellationToken"> The cancellation token to use. </param>
 351        public async Task<Response> DeleteAsync(string resourceGroupName, string scriptName, CancellationToken cancellat
 352        {
 6353            if (resourceGroupName == null)
 354            {
 0355                throw new ArgumentNullException(nameof(resourceGroupName));
 356            }
 6357            if (scriptName == null)
 358            {
 0359                throw new ArgumentNullException(nameof(scriptName));
 360            }
 361
 6362            using var message = CreateDeleteRequest(resourceGroupName, scriptName);
 6363            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 6364            switch (message.Response.Status)
 365            {
 366                case 200:
 367                case 204:
 6368                    return message.Response;
 369                default:
 0370                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 371            }
 6372        }
 373
 374        /// <summary> Deletes a deployment script. When operation completes, status code 200 returned without content. <
 375        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 376        /// <param name="scriptName"> Name of the deployment script. </param>
 377        /// <param name="cancellationToken"> The cancellation token to use. </param>
 378        public Response Delete(string resourceGroupName, string scriptName, CancellationToken cancellationToken = defaul
 379        {
 6380            if (resourceGroupName == null)
 381            {
 0382                throw new ArgumentNullException(nameof(resourceGroupName));
 383            }
 6384            if (scriptName == null)
 385            {
 0386                throw new ArgumentNullException(nameof(scriptName));
 387            }
 388
 6389            using var message = CreateDeleteRequest(resourceGroupName, scriptName);
 6390            _pipeline.Send(message, cancellationToken);
 6391            switch (message.Response.Status)
 392            {
 393                case 200:
 394                case 204:
 6395                    return message.Response;
 396                default:
 0397                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 398            }
 6399        }
 400
 401        internal Core.HttpMessage CreateListBySubscriptionRequest()
 402        {
 8403            var message = _pipeline.CreateMessage();
 8404            var request = message.Request;
 8405            request.Method = RequestMethod.Get;
 8406            var uri = new RawRequestUriBuilder();
 8407            uri.Reset(endpoint);
 8408            uri.AppendPath("/subscriptions/", false);
 8409            uri.AppendPath(subscriptionId, true);
 8410            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts", false);
 8411            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 8412            request.Uri = uri;
 8413            return message;
 414        }
 415
 416        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 417        /// <param name="cancellationToken"> The cancellation token to use. </param>
 418        public async Task<Response<DeploymentScriptListResult>> ListBySubscriptionAsync(CancellationToken cancellationTo
 419        {
 4420            using var message = CreateListBySubscriptionRequest();
 4421            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 4422            switch (message.Response.Status)
 423            {
 424                case 200:
 425                    {
 4426                        DeploymentScriptListResult value = default;
 4427                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 4428                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 429                        {
 0430                            value = null;
 431                        }
 432                        else
 433                        {
 4434                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 435                        }
 4436                        return Response.FromValue(value, message.Response);
 437                    }
 438                default:
 0439                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 440            }
 4441        }
 442
 443        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 444        /// <param name="cancellationToken"> The cancellation token to use. </param>
 445        public Response<DeploymentScriptListResult> ListBySubscription(CancellationToken cancellationToken = default)
 446        {
 4447            using var message = CreateListBySubscriptionRequest();
 4448            _pipeline.Send(message, cancellationToken);
 4449            switch (message.Response.Status)
 450            {
 451                case 200:
 452                    {
 4453                        DeploymentScriptListResult value = default;
 4454                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 4455                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 456                        {
 0457                            value = null;
 458                        }
 459                        else
 460                        {
 4461                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 462                        }
 4463                        return Response.FromValue(value, message.Response);
 464                    }
 465                default:
 0466                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 467            }
 4468        }
 469
 470        internal Core.HttpMessage CreateGetLogsRequest(string resourceGroupName, string scriptName)
 471        {
 0472            var message = _pipeline.CreateMessage();
 0473            var request = message.Request;
 0474            request.Method = RequestMethod.Get;
 0475            var uri = new RawRequestUriBuilder();
 0476            uri.Reset(endpoint);
 0477            uri.AppendPath("/subscriptions/", false);
 0478            uri.AppendPath(subscriptionId, true);
 0479            uri.AppendPath("/resourcegroups/", false);
 0480            uri.AppendPath(resourceGroupName, true);
 0481            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 0482            uri.AppendPath(scriptName, true);
 0483            uri.AppendPath("/logs", false);
 0484            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 0485            request.Uri = uri;
 0486            return message;
 487        }
 488
 489        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 490        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 491        /// <param name="scriptName"> Name of the deployment script. </param>
 492        /// <param name="cancellationToken"> The cancellation token to use. </param>
 493        public async Task<Response<ScriptLogsList>> GetLogsAsync(string resourceGroupName, string scriptName, Cancellati
 494        {
 0495            if (resourceGroupName == null)
 496            {
 0497                throw new ArgumentNullException(nameof(resourceGroupName));
 498            }
 0499            if (scriptName == null)
 500            {
 0501                throw new ArgumentNullException(nameof(scriptName));
 502            }
 503
 0504            using var message = CreateGetLogsRequest(resourceGroupName, scriptName);
 0505            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0506            switch (message.Response.Status)
 507            {
 508                case 200:
 509                    {
 0510                        ScriptLogsList value = default;
 0511                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0512                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 513                        {
 0514                            value = null;
 515                        }
 516                        else
 517                        {
 0518                            value = ScriptLogsList.DeserializeScriptLogsList(document.RootElement);
 519                        }
 0520                        return Response.FromValue(value, message.Response);
 521                    }
 522                default:
 0523                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 524            }
 0525        }
 526
 527        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 528        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 529        /// <param name="scriptName"> Name of the deployment script. </param>
 530        /// <param name="cancellationToken"> The cancellation token to use. </param>
 531        public Response<ScriptLogsList> GetLogs(string resourceGroupName, string scriptName, CancellationToken cancellat
 532        {
 0533            if (resourceGroupName == null)
 534            {
 0535                throw new ArgumentNullException(nameof(resourceGroupName));
 536            }
 0537            if (scriptName == null)
 538            {
 0539                throw new ArgumentNullException(nameof(scriptName));
 540            }
 541
 0542            using var message = CreateGetLogsRequest(resourceGroupName, scriptName);
 0543            _pipeline.Send(message, cancellationToken);
 0544            switch (message.Response.Status)
 545            {
 546                case 200:
 547                    {
 0548                        ScriptLogsList value = default;
 0549                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0550                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 551                        {
 0552                            value = null;
 553                        }
 554                        else
 555                        {
 0556                            value = ScriptLogsList.DeserializeScriptLogsList(document.RootElement);
 557                        }
 0558                        return Response.FromValue(value, message.Response);
 559                    }
 560                default:
 0561                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 562            }
 0563        }
 564
 565        internal Core.HttpMessage CreateGetLogsDefaultRequest(string resourceGroupName, string scriptName, int? tail)
 566        {
 4567            var message = _pipeline.CreateMessage();
 4568            var request = message.Request;
 4569            request.Method = RequestMethod.Get;
 4570            var uri = new RawRequestUriBuilder();
 4571            uri.Reset(endpoint);
 4572            uri.AppendPath("/subscriptions/", false);
 4573            uri.AppendPath(subscriptionId, true);
 4574            uri.AppendPath("/resourcegroups/", false);
 4575            uri.AppendPath(resourceGroupName, true);
 4576            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts/", false);
 4577            uri.AppendPath(scriptName, true);
 4578            uri.AppendPath("/logs/default", false);
 4579            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 4580            if (tail != null)
 581            {
 0582                uri.AppendQuery("tail", tail.Value, true);
 583            }
 4584            request.Uri = uri;
 4585            return message;
 586        }
 587
 588        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 589        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 590        /// <param name="scriptName"> Name of the deployment script. </param>
 591        /// <param name="tail"> The number of lines to show from the tail of the deployment script log. Valid value is a
 592        /// <param name="cancellationToken"> The cancellation token to use. </param>
 593        public async Task<Response<ScriptLog>> GetLogsDefaultAsync(string resourceGroupName, string scriptName, int? tai
 594        {
 2595            if (resourceGroupName == null)
 596            {
 0597                throw new ArgumentNullException(nameof(resourceGroupName));
 598            }
 2599            if (scriptName == null)
 600            {
 0601                throw new ArgumentNullException(nameof(scriptName));
 602            }
 603
 2604            using var message = CreateGetLogsDefaultRequest(resourceGroupName, scriptName, tail);
 2605            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 2606            switch (message.Response.Status)
 607            {
 608                case 200:
 609                    {
 2610                        ScriptLog value = default;
 2611                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 2612                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 613                        {
 0614                            value = null;
 615                        }
 616                        else
 617                        {
 2618                            value = ScriptLog.DeserializeScriptLog(document.RootElement);
 619                        }
 2620                        return Response.FromValue(value, message.Response);
 621                    }
 622                default:
 0623                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 624            }
 2625        }
 626
 627        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 628        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 629        /// <param name="scriptName"> Name of the deployment script. </param>
 630        /// <param name="tail"> The number of lines to show from the tail of the deployment script log. Valid value is a
 631        /// <param name="cancellationToken"> The cancellation token to use. </param>
 632        public Response<ScriptLog> GetLogsDefault(string resourceGroupName, string scriptName, int? tail = null, Cancell
 633        {
 2634            if (resourceGroupName == null)
 635            {
 0636                throw new ArgumentNullException(nameof(resourceGroupName));
 637            }
 2638            if (scriptName == null)
 639            {
 0640                throw new ArgumentNullException(nameof(scriptName));
 641            }
 642
 2643            using var message = CreateGetLogsDefaultRequest(resourceGroupName, scriptName, tail);
 2644            _pipeline.Send(message, cancellationToken);
 2645            switch (message.Response.Status)
 646            {
 647                case 200:
 648                    {
 2649                        ScriptLog value = default;
 2650                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 2651                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 652                        {
 0653                            value = null;
 654                        }
 655                        else
 656                        {
 2657                            value = ScriptLog.DeserializeScriptLog(document.RootElement);
 658                        }
 2659                        return Response.FromValue(value, message.Response);
 660                    }
 661                default:
 0662                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 663            }
 2664        }
 665
 666        internal Core.HttpMessage CreateListByResourceGroupRequest(string resourceGroupName)
 667        {
 16668            var message = _pipeline.CreateMessage();
 16669            var request = message.Request;
 16670            request.Method = RequestMethod.Get;
 16671            var uri = new RawRequestUriBuilder();
 16672            uri.Reset(endpoint);
 16673            uri.AppendPath("/subscriptions/", false);
 16674            uri.AppendPath(subscriptionId, true);
 16675            uri.AppendPath("/resourcegroups/", false);
 16676            uri.AppendPath(resourceGroupName, true);
 16677            uri.AppendPath("/providers/Microsoft.Resources/deploymentScripts", false);
 16678            uri.AppendQuery("api-version", "2019-10-01-preview", true);
 16679            request.Uri = uri;
 16680            return message;
 681        }
 682
 683        /// <summary> Lists deployments scripts. </summary>
 684        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 685        /// <param name="cancellationToken"> The cancellation token to use. </param>
 686        public async Task<Response<DeploymentScriptListResult>> ListByResourceGroupAsync(string resourceGroupName, Cance
 687        {
 8688            if (resourceGroupName == null)
 689            {
 0690                throw new ArgumentNullException(nameof(resourceGroupName));
 691            }
 692
 8693            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 8694            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 8695            switch (message.Response.Status)
 696            {
 697                case 200:
 698                    {
 8699                        DeploymentScriptListResult value = default;
 8700                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 8701                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 702                        {
 0703                            value = null;
 704                        }
 705                        else
 706                        {
 8707                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 708                        }
 8709                        return Response.FromValue(value, message.Response);
 710                    }
 711                default:
 0712                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 713            }
 8714        }
 715
 716        /// <summary> Lists deployments scripts. </summary>
 717        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 718        /// <param name="cancellationToken"> The cancellation token to use. </param>
 719        public Response<DeploymentScriptListResult> ListByResourceGroup(string resourceGroupName, CancellationToken canc
 720        {
 8721            if (resourceGroupName == null)
 722            {
 0723                throw new ArgumentNullException(nameof(resourceGroupName));
 724            }
 725
 8726            using var message = CreateListByResourceGroupRequest(resourceGroupName);
 8727            _pipeline.Send(message, cancellationToken);
 8728            switch (message.Response.Status)
 729            {
 730                case 200:
 731                    {
 8732                        DeploymentScriptListResult value = default;
 8733                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 8734                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 735                        {
 0736                            value = null;
 737                        }
 738                        else
 739                        {
 8740                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 741                        }
 8742                        return Response.FromValue(value, message.Response);
 743                    }
 744                default:
 0745                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 746            }
 8747        }
 748
 749        internal Core.HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink)
 750        {
 0751            var message = _pipeline.CreateMessage();
 0752            var request = message.Request;
 0753            request.Method = RequestMethod.Get;
 0754            var uri = new RawRequestUriBuilder();
 0755            uri.Reset(endpoint);
 0756            uri.AppendRawNextLink(nextLink, false);
 0757            request.Uri = uri;
 0758            return message;
 759        }
 760
 761        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 762        /// <param name="nextLink"> The URL to the next page of results. </param>
 763        /// <param name="cancellationToken"> The cancellation token to use. </param>
 764        public async Task<Response<DeploymentScriptListResult>> ListBySubscriptionNextPageAsync(string nextLink, Cancell
 765        {
 0766            if (nextLink == null)
 767            {
 0768                throw new ArgumentNullException(nameof(nextLink));
 769            }
 770
 0771            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0772            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0773            switch (message.Response.Status)
 774            {
 775                case 200:
 776                    {
 0777                        DeploymentScriptListResult value = default;
 0778                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0779                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 780                        {
 0781                            value = null;
 782                        }
 783                        else
 784                        {
 0785                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 786                        }
 0787                        return Response.FromValue(value, message.Response);
 788                    }
 789                default:
 0790                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 791            }
 0792        }
 793
 794        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 795        /// <param name="nextLink"> The URL to the next page of results. </param>
 796        /// <param name="cancellationToken"> The cancellation token to use. </param>
 797        public Response<DeploymentScriptListResult> ListBySubscriptionNextPage(string nextLink, CancellationToken cancel
 798        {
 0799            if (nextLink == null)
 800            {
 0801                throw new ArgumentNullException(nameof(nextLink));
 802            }
 803
 0804            using var message = CreateListBySubscriptionNextPageRequest(nextLink);
 0805            _pipeline.Send(message, cancellationToken);
 0806            switch (message.Response.Status)
 807            {
 808                case 200:
 809                    {
 0810                        DeploymentScriptListResult value = default;
 0811                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0812                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 813                        {
 0814                            value = null;
 815                        }
 816                        else
 817                        {
 0818                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 819                        }
 0820                        return Response.FromValue(value, message.Response);
 821                    }
 822                default:
 0823                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 824            }
 0825        }
 826
 827        internal Core.HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName)
 828        {
 0829            var message = _pipeline.CreateMessage();
 0830            var request = message.Request;
 0831            request.Method = RequestMethod.Get;
 0832            var uri = new RawRequestUriBuilder();
 0833            uri.Reset(endpoint);
 0834            uri.AppendRawNextLink(nextLink, false);
 0835            request.Uri = uri;
 0836            return message;
 837        }
 838
 839        /// <summary> Lists deployments scripts. </summary>
 840        /// <param name="nextLink"> The URL to the next page of results. </param>
 841        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 842        /// <param name="cancellationToken"> The cancellation token to use. </param>
 843        public async Task<Response<DeploymentScriptListResult>> ListByResourceGroupNextPageAsync(string nextLink, string
 844        {
 0845            if (nextLink == null)
 846            {
 0847                throw new ArgumentNullException(nameof(nextLink));
 848            }
 0849            if (resourceGroupName == null)
 850            {
 0851                throw new ArgumentNullException(nameof(resourceGroupName));
 852            }
 853
 0854            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0855            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
 0856            switch (message.Response.Status)
 857            {
 858                case 200:
 859                    {
 0860                        DeploymentScriptListResult value = default;
 0861                        using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc
 0862                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 863                        {
 0864                            value = null;
 865                        }
 866                        else
 867                        {
 0868                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 869                        }
 0870                        return Response.FromValue(value, message.Response);
 871                    }
 872                default:
 0873                    throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa
 874            }
 0875        }
 876
 877        /// <summary> Lists deployments scripts. </summary>
 878        /// <param name="nextLink"> The URL to the next page of results. </param>
 879        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 880        /// <param name="cancellationToken"> The cancellation token to use. </param>
 881        public Response<DeploymentScriptListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupNam
 882        {
 0883            if (nextLink == null)
 884            {
 0885                throw new ArgumentNullException(nameof(nextLink));
 886            }
 0887            if (resourceGroupName == null)
 888            {
 0889                throw new ArgumentNullException(nameof(resourceGroupName));
 890            }
 891
 0892            using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName);
 0893            _pipeline.Send(message, cancellationToken);
 0894            switch (message.Response.Status)
 895            {
 896                case 200:
 897                    {
 0898                        DeploymentScriptListResult value = default;
 0899                        using var document = JsonDocument.Parse(message.Response.ContentStream);
 0900                        if (document.RootElement.ValueKind == JsonValueKind.Null)
 901                        {
 0902                            value = null;
 903                        }
 904                        else
 905                        {
 0906                            value = DeploymentScriptListResult.DeserializeDeploymentScriptListResult(document.RootElemen
 907                        }
 0908                        return Response.FromValue(value, message.Response);
 909                    }
 910                default:
 0911                    throw _clientDiagnostics.CreateRequestFailedException(message.Response);
 912            }
 0913        }
 914    }
 915}