< Summary

Class:Azure.ResourceManager.Resources.DeploymentScriptsOperations
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\DeploymentScriptsOperations.cs
Covered lines:74
Uncovered lines:104
Coverable lines:178
Total lines:462
Line coverage:41.5% (74 of 178)
Covered branches:8
Total branches:16
Branch coverage:50% (8 of 16)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
UpdateAsync()-0%100%
Update(...)-0%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
DeleteAsync()-57.14%100%
Delete(...)-57.14%100%
GetLogsAsync()-0%100%
GetLogs(...)-0%100%
GetLogsDefaultAsync()-57.14%100%
GetLogsDefault(...)-57.14%100%
<ListBySubscriptionAsync()-62.5%100%
<ListBySubscriptionAsync()-0%100%
ListBySubscriptionAsync(...)-100%100%
ListBySubscription(...)-100%100%
ListByResourceGroupAsync(...)-36.84%50%
<ListByResourceGroupAsync()-62.5%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-36.84%50%
StartCreateAsync()-57.14%50%
StartCreate(...)-57.14%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\DeploymentScriptsOperations.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.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Resources.Models;
 15
 16namespace Azure.ResourceManager.Resources
 17{
 18    /// <summary> The DeploymentScripts service client. </summary>
 19    public partial class DeploymentScriptsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 11023        internal DeploymentScriptsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of DeploymentScriptsOperations for mocking. </summary>
 25625        protected DeploymentScriptsOperations()
 26        {
 25627        }
 28        /// <summary> Initializes a new instance of DeploymentScriptsOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 32        /// <param name="endpoint"> server parameter. </param>
 25633        internal DeploymentScriptsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 34        {
 25635            RestClient = new DeploymentScriptsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 25636            _clientDiagnostics = clientDiagnostics;
 25637            _pipeline = pipeline;
 25638        }
 39
 40        /// <summary> Updates deployment script tags with specified values. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 42        /// <param name="scriptName"> Name of the deployment script. </param>
 43        /// <param name="deploymentScript"> Deployment script resource with the tags to be updated. </param>
 44        /// <param name="cancellationToken"> The cancellation token to use. </param>
 45        public virtual async Task<Response<DeploymentScript>> UpdateAsync(string resourceGroupName, string scriptName, D
 46        {
 047            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Update");
 048            scope.Start();
 49            try
 50            {
 051                return await RestClient.UpdateAsync(resourceGroupName, scriptName, deploymentScript, cancellationToken).
 52            }
 053            catch (Exception e)
 54            {
 055                scope.Failed(e);
 056                throw;
 57            }
 058        }
 59
 60        /// <summary> Updates deployment script tags with specified values. </summary>
 61        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 62        /// <param name="scriptName"> Name of the deployment script. </param>
 63        /// <param name="deploymentScript"> Deployment script resource with the tags to be updated. </param>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Response<DeploymentScript> Update(string resourceGroupName, string scriptName, DeploymentScriptUp
 66        {
 067            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Update");
 068            scope.Start();
 69            try
 70            {
 071                return RestClient.Update(resourceGroupName, scriptName, deploymentScript, cancellationToken);
 72            }
 073            catch (Exception e)
 74            {
 075                scope.Failed(e);
 076                throw;
 77            }
 078        }
 79
 80        /// <summary> Gets a deployment script with a given name. </summary>
 81        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 82        /// <param name="scriptName"> Name of the deployment script. </param>
 83        /// <param name="cancellationToken"> The cancellation token to use. </param>
 84        public virtual async Task<Response<DeploymentScript>> GetAsync(string resourceGroupName, string scriptName, Canc
 85        {
 2486            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Get");
 2487            scope.Start();
 88            try
 89            {
 2490                return await RestClient.GetAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(false)
 91            }
 092            catch (Exception e)
 93            {
 094                scope.Failed(e);
 095                throw;
 96            }
 2497        }
 98
 99        /// <summary> Gets a deployment script with a given name. </summary>
 100        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 101        /// <param name="scriptName"> Name of the deployment script. </param>
 102        /// <param name="cancellationToken"> The cancellation token to use. </param>
 103        public virtual Response<DeploymentScript> Get(string resourceGroupName, string scriptName, CancellationToken can
 104        {
 22105            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Get");
 22106            scope.Start();
 107            try
 108            {
 22109                return RestClient.Get(resourceGroupName, scriptName, cancellationToken);
 110            }
 0111            catch (Exception e)
 112            {
 0113                scope.Failed(e);
 0114                throw;
 115            }
 22116        }
 117
 118        /// <summary> Deletes a deployment script. When operation completes, status code 200 returned without content. <
 119        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 120        /// <param name="scriptName"> Name of the deployment script. </param>
 121        /// <param name="cancellationToken"> The cancellation token to use. </param>
 122        public virtual async Task<Response> DeleteAsync(string resourceGroupName, string scriptName, CancellationToken c
 123        {
 6124            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Delete");
 6125            scope.Start();
 126            try
 127            {
 6128                return await RestClient.DeleteAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(fal
 129            }
 0130            catch (Exception e)
 131            {
 0132                scope.Failed(e);
 0133                throw;
 134            }
 6135        }
 136
 137        /// <summary> Deletes a deployment script. When operation completes, status code 200 returned without content. <
 138        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 139        /// <param name="scriptName"> Name of the deployment script. </param>
 140        /// <param name="cancellationToken"> The cancellation token to use. </param>
 141        public virtual Response Delete(string resourceGroupName, string scriptName, CancellationToken cancellationToken 
 142        {
 6143            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.Delete");
 6144            scope.Start();
 145            try
 146            {
 6147                return RestClient.Delete(resourceGroupName, scriptName, cancellationToken);
 148            }
 0149            catch (Exception e)
 150            {
 0151                scope.Failed(e);
 0152                throw;
 153            }
 6154        }
 155
 156        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 157        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 158        /// <param name="scriptName"> Name of the deployment script. </param>
 159        /// <param name="cancellationToken"> The cancellation token to use. </param>
 160        public virtual async Task<Response<ScriptLogsList>> GetLogsAsync(string resourceGroupName, string scriptName, Ca
 161        {
 0162            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.GetLogs");
 0163            scope.Start();
 164            try
 165            {
 0166                return await RestClient.GetLogsAsync(resourceGroupName, scriptName, cancellationToken).ConfigureAwait(fa
 167            }
 0168            catch (Exception e)
 169            {
 0170                scope.Failed(e);
 0171                throw;
 172            }
 0173        }
 174
 175        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 176        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 177        /// <param name="scriptName"> Name of the deployment script. </param>
 178        /// <param name="cancellationToken"> The cancellation token to use. </param>
 179        public virtual Response<ScriptLogsList> GetLogs(string resourceGroupName, string scriptName, CancellationToken c
 180        {
 0181            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.GetLogs");
 0182            scope.Start();
 183            try
 184            {
 0185                return RestClient.GetLogs(resourceGroupName, scriptName, cancellationToken);
 186            }
 0187            catch (Exception e)
 188            {
 0189                scope.Failed(e);
 0190                throw;
 191            }
 0192        }
 193
 194        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 195        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 196        /// <param name="scriptName"> Name of the deployment script. </param>
 197        /// <param name="tail"> The number of lines to show from the tail of the deployment script log. Valid value is a
 198        /// <param name="cancellationToken"> The cancellation token to use. </param>
 199        public virtual async Task<Response<ScriptLog>> GetLogsDefaultAsync(string resourceGroupName, string scriptName, 
 200        {
 2201            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.GetLogsDefault");
 2202            scope.Start();
 203            try
 204            {
 2205                return await RestClient.GetLogsDefaultAsync(resourceGroupName, scriptName, tail, cancellationToken).Conf
 206            }
 0207            catch (Exception e)
 208            {
 0209                scope.Failed(e);
 0210                throw;
 211            }
 2212        }
 213
 214        /// <summary> Gets deployment script logs for a given deployment script name. </summary>
 215        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 216        /// <param name="scriptName"> Name of the deployment script. </param>
 217        /// <param name="tail"> The number of lines to show from the tail of the deployment script log. Valid value is a
 218        /// <param name="cancellationToken"> The cancellation token to use. </param>
 219        public virtual Response<ScriptLog> GetLogsDefault(string resourceGroupName, string scriptName, int? tail = null,
 220        {
 2221            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.GetLogsDefault");
 2222            scope.Start();
 223            try
 224            {
 2225                return RestClient.GetLogsDefault(resourceGroupName, scriptName, tail, cancellationToken);
 226            }
 0227            catch (Exception e)
 228            {
 0229                scope.Failed(e);
 0230                throw;
 231            }
 2232        }
 233
 234        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 235        /// <param name="cancellationToken"> The cancellation token to use. </param>
 236        public virtual AsyncPageable<DeploymentScript> ListBySubscriptionAsync(CancellationToken cancellationToken = def
 237        {
 238            async Task<Page<DeploymentScript>> FirstPageFunc(int? pageSizeHint)
 239            {
 4240                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListBySubscription");
 4241                scope.Start();
 242                try
 243                {
 4244                    var response = await RestClient.ListBySubscriptionAsync(cancellationToken).ConfigureAwait(false);
 4245                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 246                }
 0247                catch (Exception e)
 248                {
 0249                    scope.Failed(e);
 0250                    throw;
 251                }
 4252            }
 253            async Task<Page<DeploymentScript>> NextPageFunc(string nextLink, int? pageSizeHint)
 254            {
 0255                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListBySubscription");
 0256                scope.Start();
 257                try
 258                {
 0259                    var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, cancellationToken).Configu
 0260                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 261                }
 0262                catch (Exception e)
 263                {
 0264                    scope.Failed(e);
 0265                    throw;
 266                }
 0267            }
 4268            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 269        }
 270
 271        /// <summary> Lists all deployment scripts for a given subscription. </summary>
 272        /// <param name="cancellationToken"> The cancellation token to use. </param>
 273        public virtual Pageable<DeploymentScript> ListBySubscription(CancellationToken cancellationToken = default)
 274        {
 275            Page<DeploymentScript> FirstPageFunc(int? pageSizeHint)
 276            {
 4277                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListBySubscription");
 4278                scope.Start();
 279                try
 280                {
 4281                    var response = RestClient.ListBySubscription(cancellationToken);
 4282                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 283                }
 0284                catch (Exception e)
 285                {
 0286                    scope.Failed(e);
 0287                    throw;
 288                }
 4289            }
 290            Page<DeploymentScript> NextPageFunc(string nextLink, int? pageSizeHint)
 291            {
 0292                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListBySubscription");
 0293                scope.Start();
 294                try
 295                {
 0296                    var response = RestClient.ListBySubscriptionNextPage(nextLink, cancellationToken);
 0297                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 298                }
 0299                catch (Exception e)
 300                {
 0301                    scope.Failed(e);
 0302                    throw;
 303                }
 0304            }
 4305            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 306        }
 307
 308        /// <summary> Lists deployments scripts. </summary>
 309        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 310        /// <param name="cancellationToken"> The cancellation token to use. </param>
 311        public virtual AsyncPageable<DeploymentScript> ListByResourceGroupAsync(string resourceGroupName, CancellationTo
 312        {
 8313            if (resourceGroupName == null)
 314            {
 0315                throw new ArgumentNullException(nameof(resourceGroupName));
 316            }
 317
 318            async Task<Page<DeploymentScript>> FirstPageFunc(int? pageSizeHint)
 319            {
 8320                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListByResourceGroup");
 8321                scope.Start();
 322                try
 323                {
 8324                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 8325                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 326                }
 0327                catch (Exception e)
 328                {
 0329                    scope.Failed(e);
 0330                    throw;
 331                }
 8332            }
 333            async Task<Page<DeploymentScript>> NextPageFunc(string nextLink, int? pageSizeHint)
 334            {
 0335                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListByResourceGroup");
 0336                scope.Start();
 337                try
 338                {
 0339                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0340                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 341                }
 0342                catch (Exception e)
 343                {
 0344                    scope.Failed(e);
 0345                    throw;
 346                }
 0347            }
 8348            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 349        }
 350
 351        /// <summary> Lists deployments scripts. </summary>
 352        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 353        /// <param name="cancellationToken"> The cancellation token to use. </param>
 354        public virtual Pageable<DeploymentScript> ListByResourceGroup(string resourceGroupName, CancellationToken cancel
 355        {
 8356            if (resourceGroupName == null)
 357            {
 0358                throw new ArgumentNullException(nameof(resourceGroupName));
 359            }
 360
 361            Page<DeploymentScript> FirstPageFunc(int? pageSizeHint)
 362            {
 8363                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListByResourceGroup");
 8364                scope.Start();
 365                try
 366                {
 8367                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 8368                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 369                }
 0370                catch (Exception e)
 371                {
 0372                    scope.Failed(e);
 0373                    throw;
 374                }
 8375            }
 376            Page<DeploymentScript> NextPageFunc(string nextLink, int? pageSizeHint)
 377            {
 0378                using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.ListByResourceGroup");
 0379                scope.Start();
 380                try
 381                {
 0382                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0383                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 384                }
 0385                catch (Exception e)
 386                {
 0387                    scope.Failed(e);
 0388                    throw;
 389                }
 0390            }
 8391            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 392        }
 393
 394        /// <summary> Creates a deployment script. </summary>
 395        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 396        /// <param name="scriptName"> Name of the deployment script. </param>
 397        /// <param name="deploymentScript"> Deployment script supplied to the operation. </param>
 398        /// <param name="cancellationToken"> The cancellation token to use. </param>
 399        public virtual async Task<DeploymentScriptsCreateOperation> StartCreateAsync(string resourceGroupName, string sc
 400        {
 6401            if (resourceGroupName == null)
 402            {
 0403                throw new ArgumentNullException(nameof(resourceGroupName));
 404            }
 6405            if (scriptName == null)
 406            {
 0407                throw new ArgumentNullException(nameof(scriptName));
 408            }
 6409            if (deploymentScript == null)
 410            {
 0411                throw new ArgumentNullException(nameof(deploymentScript));
 412            }
 413
 6414            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.StartCreate");
 6415            scope.Start();
 416            try
 417            {
 6418                var originalResponse = await RestClient.CreateAsync(resourceGroupName, scriptName, deploymentScript, can
 6419                return new DeploymentScriptsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateReques
 420            }
 0421            catch (Exception e)
 422            {
 0423                scope.Failed(e);
 0424                throw;
 425            }
 6426        }
 427
 428        /// <summary> Creates a deployment script. </summary>
 429        /// <param name="resourceGroupName"> The name of the resource group. The name is case insensitive. </param>
 430        /// <param name="scriptName"> Name of the deployment script. </param>
 431        /// <param name="deploymentScript"> Deployment script supplied to the operation. </param>
 432        /// <param name="cancellationToken"> The cancellation token to use. </param>
 433        public virtual DeploymentScriptsCreateOperation StartCreate(string resourceGroupName, string scriptName, Deploym
 434        {
 6435            if (resourceGroupName == null)
 436            {
 0437                throw new ArgumentNullException(nameof(resourceGroupName));
 438            }
 6439            if (scriptName == null)
 440            {
 0441                throw new ArgumentNullException(nameof(scriptName));
 442            }
 6443            if (deploymentScript == null)
 444            {
 0445                throw new ArgumentNullException(nameof(deploymentScript));
 446            }
 447
 6448            using var scope = _clientDiagnostics.CreateScope("DeploymentScriptsOperations.StartCreate");
 6449            scope.Start();
 450            try
 451            {
 6452                var originalResponse = RestClient.Create(resourceGroupName, scriptName, deploymentScript, cancellationTo
 6453                return new DeploymentScriptsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateReques
 454            }
 0455            catch (Exception e)
 456            {
 0457                scope.Failed(e);
 0458                throw;
 459            }
 6460        }
 461    }
 462}