< Summary

Class:Azure.ResourceManager.Compute.ContainerServicesOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ContainerServicesOperations.cs
Covered lines:7
Uncovered lines:139
Coverable lines:146
Total lines:364
Line coverage:4.7% (7 of 146)
Covered branches:0
Total branches:24
Branch coverage:0% (0 of 24)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-0%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-0%100%
Get(...)-0%100%
<ListAsync()-0%100%
<ListAsync()-0%100%
ListAsync(...)-0%100%
List(...)-0%100%
ListByResourceGroupAsync(...)-0%0%
<ListByResourceGroupAsync()-0%100%
<ListByResourceGroupAsync()-0%100%
ListByResourceGroup(...)-0%0%
StartCreateOrUpdateAsync()-0%0%
StartCreateOrUpdate(...)-0%0%
StartDeleteAsync()-0%0%
StartDelete(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\ContainerServicesOperations.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.Compute.Models;
 15
 16namespace Azure.ResourceManager.Compute
 17{
 18    /// <summary> The ContainerServices service client. </summary>
 19    public partial class ContainerServicesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 023        internal ContainerServicesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of ContainerServicesOperations for mocking. </summary>
 39625        protected ContainerServicesOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of ContainerServicesOperations. </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"> Subscription credentials which uniquely identify Microsoft Azure subscription.
 32        /// <param name="endpoint"> server parameter. </param>
 39633        internal ContainerServicesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscrip
 34        {
 39635            RestClient = new ContainerServicesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Gets the properties of the specified container service in the specified subscription and resource 
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual async Task<Response<ContainerService>> GetAsync(string resourceGroupName, string containerService
 45        {
 046            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.Get");
 047            scope.Start();
 48            try
 49            {
 050                return await RestClient.GetAsync(resourceGroupName, containerServiceName, cancellationToken).ConfigureAw
 51            }
 052            catch (Exception e)
 53            {
 054                scope.Failed(e);
 055                throw;
 56            }
 057        }
 58
 59        /// <summary> Gets the properties of the specified container service in the specified subscription and resource 
 60        /// <param name="resourceGroupName"> The name of the resource group. </param>
 61        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 62        /// <param name="cancellationToken"> The cancellation token to use. </param>
 63        public virtual Response<ContainerService> Get(string resourceGroupName, string containerServiceName, Cancellatio
 64        {
 065            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.Get");
 066            scope.Start();
 67            try
 68            {
 069                return RestClient.Get(resourceGroupName, containerServiceName, cancellationToken);
 70            }
 071            catch (Exception e)
 72            {
 073                scope.Failed(e);
 074                throw;
 75            }
 076        }
 77
 78        /// <summary> Gets a list of container services in the specified subscription. The operation returns properties 
 79        /// <param name="cancellationToken"> The cancellation token to use. </param>
 80        public virtual AsyncPageable<ContainerService> ListAsync(CancellationToken cancellationToken = default)
 81        {
 82            async Task<Page<ContainerService>> FirstPageFunc(int? pageSizeHint)
 83            {
 084                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List");
 085                scope.Start();
 86                try
 87                {
 088                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 089                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 90                }
 091                catch (Exception e)
 92                {
 093                    scope.Failed(e);
 094                    throw;
 95                }
 096            }
 97            async Task<Page<ContainerService>> NextPageFunc(string nextLink, int? pageSizeHint)
 98            {
 099                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List");
 0100                scope.Start();
 101                try
 102                {
 0103                    var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false)
 0104                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 105                }
 0106                catch (Exception e)
 107                {
 0108                    scope.Failed(e);
 0109                    throw;
 110                }
 0111            }
 0112            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 113        }
 114
 115        /// <summary> Gets a list of container services in the specified subscription. The operation returns properties 
 116        /// <param name="cancellationToken"> The cancellation token to use. </param>
 117        public virtual Pageable<ContainerService> List(CancellationToken cancellationToken = default)
 118        {
 119            Page<ContainerService> FirstPageFunc(int? pageSizeHint)
 120            {
 0121                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List");
 0122                scope.Start();
 123                try
 124                {
 0125                    var response = RestClient.List(cancellationToken);
 0126                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 127                }
 0128                catch (Exception e)
 129                {
 0130                    scope.Failed(e);
 0131                    throw;
 132                }
 0133            }
 134            Page<ContainerService> NextPageFunc(string nextLink, int? pageSizeHint)
 135            {
 0136                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.List");
 0137                scope.Start();
 138                try
 139                {
 0140                    var response = RestClient.ListNextPage(nextLink, cancellationToken);
 0141                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 142                }
 0143                catch (Exception e)
 144                {
 0145                    scope.Failed(e);
 0146                    throw;
 147                }
 0148            }
 0149            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 150        }
 151
 152        /// <summary> Gets a list of container services in the specified subscription and resource group. The operation 
 153        /// <param name="resourceGroupName"> The name of the resource group. </param>
 154        /// <param name="cancellationToken"> The cancellation token to use. </param>
 155        public virtual AsyncPageable<ContainerService> ListByResourceGroupAsync(string resourceGroupName, CancellationTo
 156        {
 0157            if (resourceGroupName == null)
 158            {
 0159                throw new ArgumentNullException(nameof(resourceGroupName));
 160            }
 161
 162            async Task<Page<ContainerService>> FirstPageFunc(int? pageSizeHint)
 163            {
 0164                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup");
 0165                scope.Start();
 166                try
 167                {
 0168                    var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi
 0169                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 170                }
 0171                catch (Exception e)
 172                {
 0173                    scope.Failed(e);
 0174                    throw;
 175                }
 0176            }
 177            async Task<Page<ContainerService>> NextPageFunc(string nextLink, int? pageSizeHint)
 178            {
 0179                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup");
 0180                scope.Start();
 181                try
 182                {
 0183                    var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel
 0184                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 185                }
 0186                catch (Exception e)
 187                {
 0188                    scope.Failed(e);
 0189                    throw;
 190                }
 0191            }
 0192            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 193        }
 194
 195        /// <summary> Gets a list of container services in the specified subscription and resource group. The operation 
 196        /// <param name="resourceGroupName"> The name of the resource group. </param>
 197        /// <param name="cancellationToken"> The cancellation token to use. </param>
 198        public virtual Pageable<ContainerService> ListByResourceGroup(string resourceGroupName, CancellationToken cancel
 199        {
 0200            if (resourceGroupName == null)
 201            {
 0202                throw new ArgumentNullException(nameof(resourceGroupName));
 203            }
 204
 205            Page<ContainerService> FirstPageFunc(int? pageSizeHint)
 206            {
 0207                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup");
 0208                scope.Start();
 209                try
 210                {
 0211                    var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken);
 0212                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 213                }
 0214                catch (Exception e)
 215                {
 0216                    scope.Failed(e);
 0217                    throw;
 218                }
 0219            }
 220            Page<ContainerService> NextPageFunc(string nextLink, int? pageSizeHint)
 221            {
 0222                using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.ListByResourceGroup");
 0223                scope.Start();
 224                try
 225                {
 0226                    var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken
 0227                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 228                }
 0229                catch (Exception e)
 230                {
 0231                    scope.Failed(e);
 0232                    throw;
 233                }
 0234            }
 0235            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 236        }
 237
 238        /// <summary> Creates or updates a container service with the specified configuration of orchestrator, masters, 
 239        /// <param name="resourceGroupName"> The name of the resource group. </param>
 240        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 241        /// <param name="parameters"> Parameters supplied to the Create or Update a Container Service operation. </param
 242        /// <param name="cancellationToken"> The cancellation token to use. </param>
 243        public virtual async Task<ContainerServicesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGrou
 244        {
 0245            if (resourceGroupName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(resourceGroupName));
 248            }
 0249            if (containerServiceName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(containerServiceName));
 252            }
 0253            if (parameters == null)
 254            {
 0255                throw new ArgumentNullException(nameof(parameters));
 256            }
 257
 0258            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartCreateOrUpdate");
 0259            scope.Start();
 260            try
 261            {
 0262                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, containerServiceName, par
 0263                return new ContainerServicesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCrea
 264            }
 0265            catch (Exception e)
 266            {
 0267                scope.Failed(e);
 0268                throw;
 269            }
 0270        }
 271
 272        /// <summary> Creates or updates a container service with the specified configuration of orchestrator, masters, 
 273        /// <param name="resourceGroupName"> The name of the resource group. </param>
 274        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 275        /// <param name="parameters"> Parameters supplied to the Create or Update a Container Service operation. </param
 276        /// <param name="cancellationToken"> The cancellation token to use. </param>
 277        public virtual ContainerServicesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string con
 278        {
 0279            if (resourceGroupName == null)
 280            {
 0281                throw new ArgumentNullException(nameof(resourceGroupName));
 282            }
 0283            if (containerServiceName == null)
 284            {
 0285                throw new ArgumentNullException(nameof(containerServiceName));
 286            }
 0287            if (parameters == null)
 288            {
 0289                throw new ArgumentNullException(nameof(parameters));
 290            }
 291
 0292            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartCreateOrUpdate");
 0293            scope.Start();
 294            try
 295            {
 0296                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, containerServiceName, parameters, ca
 0297                return new ContainerServicesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCrea
 298            }
 0299            catch (Exception e)
 300            {
 0301                scope.Failed(e);
 0302                throw;
 303            }
 0304        }
 305
 306        /// <summary> Deletes the specified container service in the specified subscription and resource group. The oper
 307        /// <param name="resourceGroupName"> The name of the resource group. </param>
 308        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 309        /// <param name="cancellationToken"> The cancellation token to use. </param>
 310        public virtual async Task<ContainerServicesDeleteOperation> StartDeleteAsync(string resourceGroupName, string co
 311        {
 0312            if (resourceGroupName == null)
 313            {
 0314                throw new ArgumentNullException(nameof(resourceGroupName));
 315            }
 0316            if (containerServiceName == null)
 317            {
 0318                throw new ArgumentNullException(nameof(containerServiceName));
 319            }
 320
 0321            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartDelete");
 0322            scope.Start();
 323            try
 324            {
 0325                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, containerServiceName, cancellatio
 0326                return new ContainerServicesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReques
 327            }
 0328            catch (Exception e)
 329            {
 0330                scope.Failed(e);
 0331                throw;
 332            }
 0333        }
 334
 335        /// <summary> Deletes the specified container service in the specified subscription and resource group. The oper
 336        /// <param name="resourceGroupName"> The name of the resource group. </param>
 337        /// <param name="containerServiceName"> The name of the container service in the specified subscription and reso
 338        /// <param name="cancellationToken"> The cancellation token to use. </param>
 339        public virtual ContainerServicesDeleteOperation StartDelete(string resourceGroupName, string containerServiceNam
 340        {
 0341            if (resourceGroupName == null)
 342            {
 0343                throw new ArgumentNullException(nameof(resourceGroupName));
 344            }
 0345            if (containerServiceName == null)
 346            {
 0347                throw new ArgumentNullException(nameof(containerServiceName));
 348            }
 349
 0350            using var scope = _clientDiagnostics.CreateScope("ContainerServicesOperations.StartDelete");
 0351            scope.Start();
 352            try
 353            {
 0354                var originalResponse = RestClient.Delete(resourceGroupName, containerServiceName, cancellationToken);
 0355                return new ContainerServicesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReques
 356            }
 0357            catch (Exception e)
 358            {
 0359                scope.Failed(e);
 0360                throw;
 361            }
 0362        }
 363    }
 364}