| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Compute.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Compute |
| | 17 | | { |
| | 18 | | /// <summary> The GalleryImages service client. </summary> |
| | 19 | | public partial class GalleryImagesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 56 | 23 | | internal GalleryImagesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of GalleryImagesOperations for mocking. </summary> |
| 396 | 25 | | protected GalleryImagesOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of GalleryImagesOperations. </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> |
| 396 | 33 | | internal GalleryImagesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscription |
| | 34 | | { |
| 396 | 35 | | RestClient = new GalleryImagesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves information about a gallery Image Definition. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="galleryName"> The name of the Shared Image Gallery from which the Image Definitions are to be r |
| | 43 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be retrieved. </param> |
| | 44 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 45 | | public virtual async Task<Response<GalleryImage>> GetAsync(string resourceGroupName, string galleryName, string |
| | 46 | | { |
| 4 | 47 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.Get"); |
| 4 | 48 | | scope.Start(); |
| | 49 | | try |
| | 50 | | { |
| 4 | 51 | | return await RestClient.GetAsync(resourceGroupName, galleryName, galleryImageName, cancellationToken).Co |
| | 52 | | } |
| 0 | 53 | | catch (Exception e) |
| | 54 | | { |
| 0 | 55 | | scope.Failed(e); |
| 0 | 56 | | throw; |
| | 57 | | } |
| 4 | 58 | | } |
| | 59 | |
|
| | 60 | | /// <summary> Retrieves information about a gallery Image Definition. </summary> |
| | 61 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 62 | | /// <param name="galleryName"> The name of the Shared Image Gallery from which the Image Definitions are to be r |
| | 63 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be retrieved. </param> |
| | 64 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 65 | | public virtual Response<GalleryImage> Get(string resourceGroupName, string galleryName, string galleryImageName, |
| | 66 | | { |
| 4 | 67 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.Get"); |
| 4 | 68 | | scope.Start(); |
| | 69 | | try |
| | 70 | | { |
| 4 | 71 | | return RestClient.Get(resourceGroupName, galleryName, galleryImageName, cancellationToken); |
| | 72 | | } |
| 0 | 73 | | catch (Exception e) |
| | 74 | | { |
| 0 | 75 | | scope.Failed(e); |
| 0 | 76 | | throw; |
| | 77 | | } |
| 4 | 78 | | } |
| | 79 | |
|
| | 80 | | /// <summary> List gallery Image Definitions in a gallery. </summary> |
| | 81 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 82 | | /// <param name="galleryName"> The name of the Shared Image Gallery from which Image Definitions are to be liste |
| | 83 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 84 | | public virtual AsyncPageable<GalleryImage> ListByGalleryAsync(string resourceGroupName, string galleryName, Canc |
| | 85 | | { |
| 4 | 86 | | if (resourceGroupName == null) |
| | 87 | | { |
| 0 | 88 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 89 | | } |
| 4 | 90 | | if (galleryName == null) |
| | 91 | | { |
| 0 | 92 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 93 | | } |
| | 94 | |
|
| | 95 | | async Task<Page<GalleryImage>> FirstPageFunc(int? pageSizeHint) |
| | 96 | | { |
| 4 | 97 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.ListByGallery"); |
| 4 | 98 | | scope.Start(); |
| | 99 | | try |
| | 100 | | { |
| 4 | 101 | | var response = await RestClient.ListByGalleryAsync(resourceGroupName, galleryName, cancellationToken |
| 4 | 102 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 103 | | } |
| 0 | 104 | | catch (Exception e) |
| | 105 | | { |
| 0 | 106 | | scope.Failed(e); |
| 0 | 107 | | throw; |
| | 108 | | } |
| 4 | 109 | | } |
| | 110 | | async Task<Page<GalleryImage>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 111 | | { |
| 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.ListByGallery"); |
| 0 | 113 | | scope.Start(); |
| | 114 | | try |
| | 115 | | { |
| 0 | 116 | | var response = await RestClient.ListByGalleryNextPageAsync(nextLink, resourceGroupName, galleryName, |
| 0 | 117 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 118 | | } |
| 0 | 119 | | catch (Exception e) |
| | 120 | | { |
| 0 | 121 | | scope.Failed(e); |
| 0 | 122 | | throw; |
| | 123 | | } |
| 0 | 124 | | } |
| 4 | 125 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 126 | | } |
| | 127 | |
|
| | 128 | | /// <summary> List gallery Image Definitions in a gallery. </summary> |
| | 129 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 130 | | /// <param name="galleryName"> The name of the Shared Image Gallery from which Image Definitions are to be liste |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public virtual Pageable<GalleryImage> ListByGallery(string resourceGroupName, string galleryName, CancellationTo |
| | 133 | | { |
| 4 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 4 | 138 | | if (galleryName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 141 | | } |
| | 142 | |
|
| | 143 | | Page<GalleryImage> FirstPageFunc(int? pageSizeHint) |
| | 144 | | { |
| 4 | 145 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.ListByGallery"); |
| 4 | 146 | | scope.Start(); |
| | 147 | | try |
| | 148 | | { |
| 4 | 149 | | var response = RestClient.ListByGallery(resourceGroupName, galleryName, cancellationToken); |
| 4 | 150 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 151 | | } |
| 0 | 152 | | catch (Exception e) |
| | 153 | | { |
| 0 | 154 | | scope.Failed(e); |
| 0 | 155 | | throw; |
| | 156 | | } |
| 4 | 157 | | } |
| | 158 | | Page<GalleryImage> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 159 | | { |
| 0 | 160 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.ListByGallery"); |
| 0 | 161 | | scope.Start(); |
| | 162 | | try |
| | 163 | | { |
| 0 | 164 | | var response = RestClient.ListByGalleryNextPage(nextLink, resourceGroupName, galleryName, cancellati |
| 0 | 165 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 166 | | } |
| 0 | 167 | | catch (Exception e) |
| | 168 | | { |
| 0 | 169 | | scope.Failed(e); |
| 0 | 170 | | throw; |
| | 171 | | } |
| 0 | 172 | | } |
| 4 | 173 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 174 | | } |
| | 175 | |
|
| | 176 | | /// <summary> Create or update a gallery Image Definition. </summary> |
| | 177 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 178 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be creat |
| | 179 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be created or updated. The allow |
| | 180 | | /// <param name="galleryImage"> Parameters supplied to the create or update gallery image operation. </param> |
| | 181 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 182 | | public virtual async Task<GalleryImagesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupNam |
| | 183 | | { |
| 6 | 184 | | if (resourceGroupName == null) |
| | 185 | | { |
| 0 | 186 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 187 | | } |
| 6 | 188 | | if (galleryName == null) |
| | 189 | | { |
| 0 | 190 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 191 | | } |
| 6 | 192 | | if (galleryImageName == null) |
| | 193 | | { |
| 0 | 194 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 195 | | } |
| 6 | 196 | | if (galleryImage == null) |
| | 197 | | { |
| 0 | 198 | | throw new ArgumentNullException(nameof(galleryImage)); |
| | 199 | | } |
| | 200 | |
|
| 6 | 201 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartCreateOrUpdate"); |
| 6 | 202 | | scope.Start(); |
| | 203 | | try |
| | 204 | | { |
| 6 | 205 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, galleryName, galleryImage |
| 6 | 206 | | return new GalleryImagesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOr |
| | 207 | | } |
| 0 | 208 | | catch (Exception e) |
| | 209 | | { |
| 0 | 210 | | scope.Failed(e); |
| 0 | 211 | | throw; |
| | 212 | | } |
| 6 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> Create or update a gallery Image Definition. </summary> |
| | 216 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 217 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be creat |
| | 218 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be created or updated. The allow |
| | 219 | | /// <param name="galleryImage"> Parameters supplied to the create or update gallery image operation. </param> |
| | 220 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 221 | | public virtual GalleryImagesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string gallery |
| | 222 | | { |
| 6 | 223 | | if (resourceGroupName == null) |
| | 224 | | { |
| 0 | 225 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 226 | | } |
| 6 | 227 | | if (galleryName == null) |
| | 228 | | { |
| 0 | 229 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 230 | | } |
| 6 | 231 | | if (galleryImageName == null) |
| | 232 | | { |
| 0 | 233 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 234 | | } |
| 6 | 235 | | if (galleryImage == null) |
| | 236 | | { |
| 0 | 237 | | throw new ArgumentNullException(nameof(galleryImage)); |
| | 238 | | } |
| | 239 | |
|
| 6 | 240 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartCreateOrUpdate"); |
| 6 | 241 | | scope.Start(); |
| | 242 | | try |
| | 243 | | { |
| 6 | 244 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, galleryName, galleryImageName, galle |
| 6 | 245 | | return new GalleryImagesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOr |
| | 246 | | } |
| 0 | 247 | | catch (Exception e) |
| | 248 | | { |
| 0 | 249 | | scope.Failed(e); |
| 0 | 250 | | throw; |
| | 251 | | } |
| 6 | 252 | | } |
| | 253 | |
|
| | 254 | | /// <summary> Update a gallery Image Definition. </summary> |
| | 255 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 256 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be updat |
| | 257 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be updated. The allowed characte |
| | 258 | | /// <param name="galleryImage"> Parameters supplied to the update gallery image operation. </param> |
| | 259 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 260 | | public virtual async Task<GalleryImagesUpdateOperation> StartUpdateAsync(string resourceGroupName, string galler |
| | 261 | | { |
| 0 | 262 | | if (resourceGroupName == null) |
| | 263 | | { |
| 0 | 264 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 265 | | } |
| 0 | 266 | | if (galleryName == null) |
| | 267 | | { |
| 0 | 268 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 269 | | } |
| 0 | 270 | | if (galleryImageName == null) |
| | 271 | | { |
| 0 | 272 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 273 | | } |
| 0 | 274 | | if (galleryImage == null) |
| | 275 | | { |
| 0 | 276 | | throw new ArgumentNullException(nameof(galleryImage)); |
| | 277 | | } |
| | 278 | |
|
| 0 | 279 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartUpdate"); |
| 0 | 280 | | scope.Start(); |
| | 281 | | try |
| | 282 | | { |
| 0 | 283 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, galleryName, galleryImageName, ga |
| 0 | 284 | | return new GalleryImagesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(re |
| | 285 | | } |
| 0 | 286 | | catch (Exception e) |
| | 287 | | { |
| 0 | 288 | | scope.Failed(e); |
| 0 | 289 | | throw; |
| | 290 | | } |
| 0 | 291 | | } |
| | 292 | |
|
| | 293 | | /// <summary> Update a gallery Image Definition. </summary> |
| | 294 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 295 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be updat |
| | 296 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be updated. The allowed characte |
| | 297 | | /// <param name="galleryImage"> Parameters supplied to the update gallery image operation. </param> |
| | 298 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 299 | | public virtual GalleryImagesUpdateOperation StartUpdate(string resourceGroupName, string galleryName, string gal |
| | 300 | | { |
| 0 | 301 | | if (resourceGroupName == null) |
| | 302 | | { |
| 0 | 303 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 304 | | } |
| 0 | 305 | | if (galleryName == null) |
| | 306 | | { |
| 0 | 307 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 308 | | } |
| 0 | 309 | | if (galleryImageName == null) |
| | 310 | | { |
| 0 | 311 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 312 | | } |
| 0 | 313 | | if (galleryImage == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(galleryImage)); |
| | 316 | | } |
| | 317 | |
|
| 0 | 318 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartUpdate"); |
| 0 | 319 | | scope.Start(); |
| | 320 | | try |
| | 321 | | { |
| 0 | 322 | | var originalResponse = RestClient.Update(resourceGroupName, galleryName, galleryImageName, galleryImage, |
| 0 | 323 | | return new GalleryImagesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(re |
| | 324 | | } |
| 0 | 325 | | catch (Exception e) |
| | 326 | | { |
| 0 | 327 | | scope.Failed(e); |
| 0 | 328 | | throw; |
| | 329 | | } |
| 0 | 330 | | } |
| | 331 | |
|
| | 332 | | /// <summary> Delete a gallery image. </summary> |
| | 333 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 334 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be delet |
| | 335 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be deleted. </param> |
| | 336 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 337 | | public virtual async Task<GalleryImagesDeleteOperation> StartDeleteAsync(string resourceGroupName, string galler |
| | 338 | | { |
| 4 | 339 | | if (resourceGroupName == null) |
| | 340 | | { |
| 0 | 341 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 342 | | } |
| 4 | 343 | | if (galleryName == null) |
| | 344 | | { |
| 0 | 345 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 346 | | } |
| 4 | 347 | | if (galleryImageName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 350 | | } |
| | 351 | |
|
| 4 | 352 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartDelete"); |
| 4 | 353 | | scope.Start(); |
| | 354 | | try |
| | 355 | | { |
| 4 | 356 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, galleryName, galleryImageName, ca |
| 4 | 357 | | return new GalleryImagesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(re |
| | 358 | | } |
| 0 | 359 | | catch (Exception e) |
| | 360 | | { |
| 0 | 361 | | scope.Failed(e); |
| 0 | 362 | | throw; |
| | 363 | | } |
| 4 | 364 | | } |
| | 365 | |
|
| | 366 | | /// <summary> Delete a gallery image. </summary> |
| | 367 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 368 | | /// <param name="galleryName"> The name of the Shared Image Gallery in which the Image Definition is to be delet |
| | 369 | | /// <param name="galleryImageName"> The name of the gallery Image Definition to be deleted. </param> |
| | 370 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 371 | | public virtual GalleryImagesDeleteOperation StartDelete(string resourceGroupName, string galleryName, string gal |
| | 372 | | { |
| 4 | 373 | | if (resourceGroupName == null) |
| | 374 | | { |
| 0 | 375 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 376 | | } |
| 4 | 377 | | if (galleryName == null) |
| | 378 | | { |
| 0 | 379 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 380 | | } |
| 4 | 381 | | if (galleryImageName == null) |
| | 382 | | { |
| 0 | 383 | | throw new ArgumentNullException(nameof(galleryImageName)); |
| | 384 | | } |
| | 385 | |
|
| 4 | 386 | | using var scope = _clientDiagnostics.CreateScope("GalleryImagesOperations.StartDelete"); |
| 4 | 387 | | scope.Start(); |
| | 388 | | try |
| | 389 | | { |
| 4 | 390 | | var originalResponse = RestClient.Delete(resourceGroupName, galleryName, galleryImageName, cancellationT |
| 4 | 391 | | return new GalleryImagesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(re |
| | 392 | | } |
| 0 | 393 | | catch (Exception e) |
| | 394 | | { |
| 0 | 395 | | scope.Failed(e); |
| 0 | 396 | | throw; |
| | 397 | | } |
| 4 | 398 | | } |
| | 399 | | } |
| | 400 | | } |