< Summary

Class:Azure.ResourceManager.Compute.GalleryImageVersionsOperations
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleryImageVersionsOperations.cs
Covered lines:72
Uncovered lines:100
Coverable lines:172
Total lines:442
Line coverage:41.8% (72 of 172)
Covered branches:24
Total branches:68
Branch coverage:35.2% (24 of 68)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
GetAsync()-57.14%100%
Get(...)-57.14%100%
ListByGalleryImageAsync(...)-39.13%50%
<ListByGalleryImageAsync()-62.5%100%
<ListByGalleryImageAsync()-0%100%
ListByGalleryImage(...)-39.13%50%
StartCreateOrUpdateAsync()-55.56%50%
StartCreateOrUpdate(...)-55.56%50%
StartUpdateAsync()-0%0%
StartUpdate(...)-0%0%
StartDeleteAsync()-56.25%50%
StartDelete(...)-56.25%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\GalleryImageVersionsOperations.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 GalleryImageVersions service client. </summary>
 19    public partial class GalleryImageVersionsOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 4423        internal GalleryImageVersionsRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of GalleryImageVersionsOperations for mocking. </summary>
 39625        protected GalleryImageVersionsOperations()
 26        {
 39627        }
 28        /// <summary> Initializes a new instance of GalleryImageVersionsOperations. </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 GalleryImageVersionsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subsc
 34        {
 39635            RestClient = new GalleryImageVersionsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint);
 39636            _clientDiagnostics = clientDiagnostics;
 39637            _pipeline = pipeline;
 39638        }
 39
 40        /// <summary> Retrieves information about a gallery Image Version. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 43        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 44        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be retrieved. </param>
 45        /// <param name="cancellationToken"> The cancellation token to use. </param>
 46        public virtual async Task<Response<GalleryImageVersion>> GetAsync(string resourceGroupName, string galleryName, 
 47        {
 648            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.Get");
 649            scope.Start();
 50            try
 51            {
 652                return await RestClient.GetAsync(resourceGroupName, galleryName, galleryImageName, galleryImageVersionNa
 53            }
 054            catch (Exception e)
 55            {
 056                scope.Failed(e);
 057                throw;
 58            }
 659        }
 60
 61        /// <summary> Retrieves information about a gallery Image Version. </summary>
 62        /// <param name="resourceGroupName"> The name of the resource group. </param>
 63        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 64        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 65        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be retrieved. </param>
 66        /// <param name="cancellationToken"> The cancellation token to use. </param>
 67        public virtual Response<GalleryImageVersion> Get(string resourceGroupName, string galleryName, string galleryIma
 68        {
 669            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.Get");
 670            scope.Start();
 71            try
 72            {
 673                return RestClient.Get(resourceGroupName, galleryName, galleryImageName, galleryImageVersionName, cancell
 74            }
 075            catch (Exception e)
 76            {
 077                scope.Failed(e);
 078                throw;
 79            }
 680        }
 81
 82        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 83        /// <param name="resourceGroupName"> The name of the resource group. </param>
 84        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 85        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 86        /// <param name="cancellationToken"> The cancellation token to use. </param>
 87        public virtual AsyncPageable<GalleryImageVersion> ListByGalleryImageAsync(string resourceGroupName, string galle
 88        {
 489            if (resourceGroupName == null)
 90            {
 091                throw new ArgumentNullException(nameof(resourceGroupName));
 92            }
 493            if (galleryName == null)
 94            {
 095                throw new ArgumentNullException(nameof(galleryName));
 96            }
 497            if (galleryImageName == null)
 98            {
 099                throw new ArgumentNullException(nameof(galleryImageName));
 100            }
 101
 102            async Task<Page<GalleryImageVersion>> FirstPageFunc(int? pageSizeHint)
 103            {
 4104                using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.ListByGalleryImage");
 4105                scope.Start();
 106                try
 107                {
 4108                    var response = await RestClient.ListByGalleryImageAsync(resourceGroupName, galleryName, galleryImage
 4109                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 110                }
 0111                catch (Exception e)
 112                {
 0113                    scope.Failed(e);
 0114                    throw;
 115                }
 4116            }
 117            async Task<Page<GalleryImageVersion>> NextPageFunc(string nextLink, int? pageSizeHint)
 118            {
 0119                using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.ListByGalleryImage");
 0120                scope.Start();
 121                try
 122                {
 0123                    var response = await RestClient.ListByGalleryImageNextPageAsync(nextLink, resourceGroupName, gallery
 0124                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 125                }
 0126                catch (Exception e)
 127                {
 0128                    scope.Failed(e);
 0129                    throw;
 130                }
 0131            }
 4132            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 133        }
 134
 135        /// <summary> List gallery Image Versions in a gallery Image Definition. </summary>
 136        /// <param name="resourceGroupName"> The name of the resource group. </param>
 137        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 138        /// <param name="galleryImageName"> The name of the Shared Image Gallery Image Definition from which the Image V
 139        /// <param name="cancellationToken"> The cancellation token to use. </param>
 140        public virtual Pageable<GalleryImageVersion> ListByGalleryImage(string resourceGroupName, string galleryName, st
 141        {
 4142            if (resourceGroupName == null)
 143            {
 0144                throw new ArgumentNullException(nameof(resourceGroupName));
 145            }
 4146            if (galleryName == null)
 147            {
 0148                throw new ArgumentNullException(nameof(galleryName));
 149            }
 4150            if (galleryImageName == null)
 151            {
 0152                throw new ArgumentNullException(nameof(galleryImageName));
 153            }
 154
 155            Page<GalleryImageVersion> FirstPageFunc(int? pageSizeHint)
 156            {
 4157                using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.ListByGalleryImage");
 4158                scope.Start();
 159                try
 160                {
 4161                    var response = RestClient.ListByGalleryImage(resourceGroupName, galleryName, galleryImageName, cance
 4162                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 163                }
 0164                catch (Exception e)
 165                {
 0166                    scope.Failed(e);
 0167                    throw;
 168                }
 4169            }
 170            Page<GalleryImageVersion> NextPageFunc(string nextLink, int? pageSizeHint)
 171            {
 0172                using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.ListByGalleryImage");
 0173                scope.Start();
 174                try
 175                {
 0176                    var response = RestClient.ListByGalleryImageNextPage(nextLink, resourceGroupName, galleryName, galle
 0177                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 178                }
 0179                catch (Exception e)
 180                {
 0181                    scope.Failed(e);
 0182                    throw;
 183                }
 0184            }
 4185            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 186        }
 187
 188        /// <summary> Create or update a gallery Image Version. </summary>
 189        /// <param name="resourceGroupName"> The name of the resource group. </param>
 190        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 191        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 192        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be created. Needs to follow 
 193        /// <param name="galleryImageVersion"> Parameters supplied to the create or update gallery Image Version operati
 194        /// <param name="cancellationToken"> The cancellation token to use. </param>
 195        public virtual async Task<GalleryImageVersionsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceG
 196        {
 4197            if (resourceGroupName == null)
 198            {
 0199                throw new ArgumentNullException(nameof(resourceGroupName));
 200            }
 4201            if (galleryName == null)
 202            {
 0203                throw new ArgumentNullException(nameof(galleryName));
 204            }
 4205            if (galleryImageName == null)
 206            {
 0207                throw new ArgumentNullException(nameof(galleryImageName));
 208            }
 4209            if (galleryImageVersionName == null)
 210            {
 0211                throw new ArgumentNullException(nameof(galleryImageVersionName));
 212            }
 4213            if (galleryImageVersion == null)
 214            {
 0215                throw new ArgumentNullException(nameof(galleryImageVersion));
 216            }
 217
 4218            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartCreateOrUpdate");
 4219            scope.Start();
 220            try
 221            {
 4222                var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImage
 4223                return new GalleryImageVersionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC
 224            }
 0225            catch (Exception e)
 226            {
 0227                scope.Failed(e);
 0228                throw;
 229            }
 4230        }
 231
 232        /// <summary> Create or update a gallery Image Version. </summary>
 233        /// <param name="resourceGroupName"> The name of the resource group. </param>
 234        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 235        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 236        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be created. Needs to follow 
 237        /// <param name="galleryImageVersion"> Parameters supplied to the create or update gallery Image Version operati
 238        /// <param name="cancellationToken"> The cancellation token to use. </param>
 239        public virtual GalleryImageVersionsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string 
 240        {
 4241            if (resourceGroupName == null)
 242            {
 0243                throw new ArgumentNullException(nameof(resourceGroupName));
 244            }
 4245            if (galleryName == null)
 246            {
 0247                throw new ArgumentNullException(nameof(galleryName));
 248            }
 4249            if (galleryImageName == null)
 250            {
 0251                throw new ArgumentNullException(nameof(galleryImageName));
 252            }
 4253            if (galleryImageVersionName == null)
 254            {
 0255                throw new ArgumentNullException(nameof(galleryImageVersionName));
 256            }
 4257            if (galleryImageVersion == null)
 258            {
 0259                throw new ArgumentNullException(nameof(galleryImageVersion));
 260            }
 261
 4262            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartCreateOrUpdate");
 4263            scope.Start();
 264            try
 265            {
 4266                var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, galleryName, galleryImageName, galle
 4267                return new GalleryImageVersionsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateC
 268            }
 0269            catch (Exception e)
 270            {
 0271                scope.Failed(e);
 0272                throw;
 273            }
 4274        }
 275
 276        /// <summary> Update a gallery Image Version. </summary>
 277        /// <param name="resourceGroupName"> The name of the resource group. </param>
 278        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 279        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 280        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be updated. Needs to follow 
 281        /// <param name="galleryImageVersion"> Parameters supplied to the update gallery Image Version operation. </para
 282        /// <param name="cancellationToken"> The cancellation token to use. </param>
 283        public virtual async Task<GalleryImageVersionsUpdateOperation> StartUpdateAsync(string resourceGroupName, string
 284        {
 0285            if (resourceGroupName == null)
 286            {
 0287                throw new ArgumentNullException(nameof(resourceGroupName));
 288            }
 0289            if (galleryName == null)
 290            {
 0291                throw new ArgumentNullException(nameof(galleryName));
 292            }
 0293            if (galleryImageName == null)
 294            {
 0295                throw new ArgumentNullException(nameof(galleryImageName));
 296            }
 0297            if (galleryImageVersionName == null)
 298            {
 0299                throw new ArgumentNullException(nameof(galleryImageVersionName));
 300            }
 0301            if (galleryImageVersion == null)
 302            {
 0303                throw new ArgumentNullException(nameof(galleryImageVersion));
 304            }
 305
 0306            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartUpdate");
 0307            scope.Start();
 308            try
 309            {
 0310                var originalResponse = await RestClient.UpdateAsync(resourceGroupName, galleryName, galleryImageName, ga
 0311                return new GalleryImageVersionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateReq
 312            }
 0313            catch (Exception e)
 314            {
 0315                scope.Failed(e);
 0316                throw;
 317            }
 0318        }
 319
 320        /// <summary> Update a gallery Image Version. </summary>
 321        /// <param name="resourceGroupName"> The name of the resource group. </param>
 322        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 323        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version is to be
 324        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be updated. Needs to follow 
 325        /// <param name="galleryImageVersion"> Parameters supplied to the update gallery Image Version operation. </para
 326        /// <param name="cancellationToken"> The cancellation token to use. </param>
 327        public virtual GalleryImageVersionsUpdateOperation StartUpdate(string resourceGroupName, string galleryName, str
 328        {
 0329            if (resourceGroupName == null)
 330            {
 0331                throw new ArgumentNullException(nameof(resourceGroupName));
 332            }
 0333            if (galleryName == null)
 334            {
 0335                throw new ArgumentNullException(nameof(galleryName));
 336            }
 0337            if (galleryImageName == null)
 338            {
 0339                throw new ArgumentNullException(nameof(galleryImageName));
 340            }
 0341            if (galleryImageVersionName == null)
 342            {
 0343                throw new ArgumentNullException(nameof(galleryImageVersionName));
 344            }
 0345            if (galleryImageVersion == null)
 346            {
 0347                throw new ArgumentNullException(nameof(galleryImageVersion));
 348            }
 349
 0350            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartUpdate");
 0351            scope.Start();
 352            try
 353            {
 0354                var originalResponse = RestClient.Update(resourceGroupName, galleryName, galleryImageName, galleryImageV
 0355                return new GalleryImageVersionsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateReq
 356            }
 0357            catch (Exception e)
 358            {
 0359                scope.Failed(e);
 0360                throw;
 361            }
 0362        }
 363
 364        /// <summary> Delete a gallery Image Version. </summary>
 365        /// <param name="resourceGroupName"> The name of the resource group. </param>
 366        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 367        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 368        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be deleted. </param>
 369        /// <param name="cancellationToken"> The cancellation token to use. </param>
 370        public virtual async Task<GalleryImageVersionsDeleteOperation> StartDeleteAsync(string resourceGroupName, string
 371        {
 2372            if (resourceGroupName == null)
 373            {
 0374                throw new ArgumentNullException(nameof(resourceGroupName));
 375            }
 2376            if (galleryName == null)
 377            {
 0378                throw new ArgumentNullException(nameof(galleryName));
 379            }
 2380            if (galleryImageName == null)
 381            {
 0382                throw new ArgumentNullException(nameof(galleryImageName));
 383            }
 2384            if (galleryImageVersionName == null)
 385            {
 0386                throw new ArgumentNullException(nameof(galleryImageVersionName));
 387            }
 388
 2389            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartDelete");
 2390            scope.Start();
 391            try
 392            {
 2393                var originalResponse = await RestClient.DeleteAsync(resourceGroupName, galleryName, galleryImageName, ga
 2394                return new GalleryImageVersionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq
 395            }
 0396            catch (Exception e)
 397            {
 0398                scope.Failed(e);
 0399                throw;
 400            }
 2401        }
 402
 403        /// <summary> Delete a gallery Image Version. </summary>
 404        /// <param name="resourceGroupName"> The name of the resource group. </param>
 405        /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition resides. </par
 406        /// <param name="galleryImageName"> The name of the gallery Image Definition in which the Image Version resides.
 407        /// <param name="galleryImageVersionName"> The name of the gallery Image Version to be deleted. </param>
 408        /// <param name="cancellationToken"> The cancellation token to use. </param>
 409        public virtual GalleryImageVersionsDeleteOperation StartDelete(string resourceGroupName, string galleryName, str
 410        {
 2411            if (resourceGroupName == null)
 412            {
 0413                throw new ArgumentNullException(nameof(resourceGroupName));
 414            }
 2415            if (galleryName == null)
 416            {
 0417                throw new ArgumentNullException(nameof(galleryName));
 418            }
 2419            if (galleryImageName == null)
 420            {
 0421                throw new ArgumentNullException(nameof(galleryImageName));
 422            }
 2423            if (galleryImageVersionName == null)
 424            {
 0425                throw new ArgumentNullException(nameof(galleryImageVersionName));
 426            }
 427
 2428            using var scope = _clientDiagnostics.CreateScope("GalleryImageVersionsOperations.StartDelete");
 2429            scope.Start();
 430            try
 431            {
 2432                var originalResponse = RestClient.Delete(resourceGroupName, galleryName, galleryImageName, galleryImageV
 2433                return new GalleryImageVersionsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteReq
 434            }
 0435            catch (Exception e)
 436            {
 0437                scope.Failed(e);
 0438                throw;
 439            }
 2440        }
 441    }
 442}