| | 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 Galleries service client. </summary> |
| | 19 | | public partial class GalleriesOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 108 | 23 | | internal GalleriesRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of GalleriesOperations for mocking. </summary> |
| 396 | 25 | | protected GalleriesOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of GalleriesOperations. </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 GalleriesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, |
| | 34 | | { |
| 396 | 35 | | RestClient = new GalleriesRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Retrieves information about a Shared Image Gallery. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="galleryName"> The name of the Shared Image Gallery. </param> |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<Gallery>> GetAsync(string resourceGroupName, string galleryName, Cancellation |
| | 45 | | { |
| 4 | 46 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.Get"); |
| 4 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 4 | 50 | | return await RestClient.GetAsync(resourceGroupName, galleryName, cancellationToken).ConfigureAwait(false |
| | 51 | | } |
| 0 | 52 | | catch (Exception e) |
| | 53 | | { |
| 0 | 54 | | scope.Failed(e); |
| 0 | 55 | | throw; |
| | 56 | | } |
| 4 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Retrieves information about a Shared Image Gallery. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="galleryName"> The name of the Shared Image Gallery. </param> |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<Gallery> Get(string resourceGroupName, string galleryName, CancellationToken cancellatio |
| | 64 | | { |
| 4 | 65 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.Get"); |
| 4 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 4 | 69 | | return RestClient.Get(resourceGroupName, galleryName, cancellationToken); |
| | 70 | | } |
| 0 | 71 | | catch (Exception e) |
| | 72 | | { |
| 0 | 73 | | scope.Failed(e); |
| 0 | 74 | | throw; |
| | 75 | | } |
| 4 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> List galleries under a resource group. </summary> |
| | 79 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 80 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 81 | | public virtual AsyncPageable<Gallery> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cance |
| | 82 | | { |
| 4 | 83 | | if (resourceGroupName == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 86 | | } |
| | 87 | |
|
| | 88 | | async Task<Page<Gallery>> FirstPageFunc(int? pageSizeHint) |
| | 89 | | { |
| 4 | 90 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.ListByResourceGroup"); |
| 4 | 91 | | scope.Start(); |
| | 92 | | try |
| | 93 | | { |
| 4 | 94 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 4 | 95 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 96 | | } |
| 0 | 97 | | catch (Exception e) |
| | 98 | | { |
| 0 | 99 | | scope.Failed(e); |
| 0 | 100 | | throw; |
| | 101 | | } |
| 4 | 102 | | } |
| | 103 | | async Task<Page<Gallery>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.ListByResourceGroup"); |
| 0 | 106 | | scope.Start(); |
| | 107 | | try |
| | 108 | | { |
| 0 | 109 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, cancel |
| 0 | 110 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 111 | | } |
| 0 | 112 | | catch (Exception e) |
| | 113 | | { |
| 0 | 114 | | scope.Failed(e); |
| 0 | 115 | | throw; |
| | 116 | | } |
| 0 | 117 | | } |
| 4 | 118 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 119 | | } |
| | 120 | |
|
| | 121 | | /// <summary> List galleries under a resource group. </summary> |
| | 122 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 123 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 124 | | public virtual Pageable<Gallery> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationTok |
| | 125 | | { |
| 4 | 126 | | if (resourceGroupName == null) |
| | 127 | | { |
| 0 | 128 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 129 | | } |
| | 130 | |
|
| | 131 | | Page<Gallery> FirstPageFunc(int? pageSizeHint) |
| | 132 | | { |
| 4 | 133 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.ListByResourceGroup"); |
| 4 | 134 | | scope.Start(); |
| | 135 | | try |
| | 136 | | { |
| 4 | 137 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 4 | 138 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 139 | | } |
| 0 | 140 | | catch (Exception e) |
| | 141 | | { |
| 0 | 142 | | scope.Failed(e); |
| 0 | 143 | | throw; |
| | 144 | | } |
| 4 | 145 | | } |
| | 146 | | Page<Gallery> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 147 | | { |
| 0 | 148 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.ListByResourceGroup"); |
| 0 | 149 | | scope.Start(); |
| | 150 | | try |
| | 151 | | { |
| 0 | 152 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, cancellationToken |
| 0 | 153 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 154 | | } |
| 0 | 155 | | catch (Exception e) |
| | 156 | | { |
| 0 | 157 | | scope.Failed(e); |
| 0 | 158 | | throw; |
| | 159 | | } |
| 0 | 160 | | } |
| 4 | 161 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> List galleries under a subscription. </summary> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public virtual AsyncPageable<Gallery> ListAsync(CancellationToken cancellationToken = default) |
| | 167 | | { |
| | 168 | | async Task<Page<Gallery>> FirstPageFunc(int? pageSizeHint) |
| | 169 | | { |
| 2 | 170 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.List"); |
| 2 | 171 | | scope.Start(); |
| | 172 | | try |
| | 173 | | { |
| 2 | 174 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 2 | 175 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 176 | | } |
| 0 | 177 | | catch (Exception e) |
| | 178 | | { |
| 0 | 179 | | scope.Failed(e); |
| 0 | 180 | | throw; |
| | 181 | | } |
| 2 | 182 | | } |
| | 183 | | async Task<Page<Gallery>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 184 | | { |
| 0 | 185 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.List"); |
| 0 | 186 | | scope.Start(); |
| | 187 | | try |
| | 188 | | { |
| 0 | 189 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| 0 | 190 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 191 | | } |
| 0 | 192 | | catch (Exception e) |
| | 193 | | { |
| 0 | 194 | | scope.Failed(e); |
| 0 | 195 | | throw; |
| | 196 | | } |
| 0 | 197 | | } |
| 2 | 198 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 199 | | } |
| | 200 | |
|
| | 201 | | /// <summary> List galleries under a subscription. </summary> |
| | 202 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 203 | | public virtual Pageable<Gallery> List(CancellationToken cancellationToken = default) |
| | 204 | | { |
| | 205 | | Page<Gallery> FirstPageFunc(int? pageSizeHint) |
| | 206 | | { |
| 2 | 207 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.List"); |
| 2 | 208 | | scope.Start(); |
| | 209 | | try |
| | 210 | | { |
| 2 | 211 | | var response = RestClient.List(cancellationToken); |
| 2 | 212 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 213 | | } |
| 0 | 214 | | catch (Exception e) |
| | 215 | | { |
| 0 | 216 | | scope.Failed(e); |
| 0 | 217 | | throw; |
| | 218 | | } |
| 2 | 219 | | } |
| | 220 | | Page<Gallery> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 221 | | { |
| 0 | 222 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.List"); |
| 0 | 223 | | scope.Start(); |
| | 224 | | try |
| | 225 | | { |
| 0 | 226 | | var response = RestClient.ListNextPage(nextLink, cancellationToken); |
| 0 | 227 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 228 | | } |
| 0 | 229 | | catch (Exception e) |
| | 230 | | { |
| 0 | 231 | | scope.Failed(e); |
| 0 | 232 | | throw; |
| | 233 | | } |
| 0 | 234 | | } |
| 2 | 235 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Create or update a Shared Image Gallery. </summary> |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 240 | | /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu |
| | 241 | | /// <param name="gallery"> Parameters supplied to the create or update Shared Image Gallery operation. </param> |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public virtual async Task<GalleriesCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, s |
| | 244 | | { |
| 12 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 12 | 249 | | if (galleryName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 252 | | } |
| 12 | 253 | | if (gallery == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(gallery)); |
| | 256 | | } |
| | 257 | |
|
| 12 | 258 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartCreateOrUpdate"); |
| 12 | 259 | | scope.Start(); |
| | 260 | | try |
| | 261 | | { |
| 12 | 262 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, galleryName, gallery, can |
| 12 | 263 | | return new GalleriesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpda |
| | 264 | | } |
| 0 | 265 | | catch (Exception e) |
| | 266 | | { |
| 0 | 267 | | scope.Failed(e); |
| 0 | 268 | | throw; |
| | 269 | | } |
| 12 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Create or update a Shared Image Gallery. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu |
| | 275 | | /// <param name="gallery"> Parameters supplied to the create or update Shared Image Gallery operation. </param> |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public virtual GalleriesCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string galleryName |
| | 278 | | { |
| 12 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 12 | 283 | | if (galleryName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 286 | | } |
| 12 | 287 | | if (gallery == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(gallery)); |
| | 290 | | } |
| | 291 | |
|
| 12 | 292 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartCreateOrUpdate"); |
| 12 | 293 | | scope.Start(); |
| | 294 | | try |
| | 295 | | { |
| 12 | 296 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, galleryName, gallery, cancellationTo |
| 12 | 297 | | return new GalleriesCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpda |
| | 298 | | } |
| 0 | 299 | | catch (Exception e) |
| | 300 | | { |
| 0 | 301 | | scope.Failed(e); |
| 0 | 302 | | throw; |
| | 303 | | } |
| 12 | 304 | | } |
| | 305 | |
|
| | 306 | | /// <summary> Update a Shared Image Gallery. </summary> |
| | 307 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 308 | | /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu |
| | 309 | | /// <param name="gallery"> Parameters supplied to the update Shared Image Gallery operation. </param> |
| | 310 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 311 | | public virtual async Task<GalleriesUpdateOperation> StartUpdateAsync(string resourceGroupName, string galleryNam |
| | 312 | | { |
| 0 | 313 | | if (resourceGroupName == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 316 | | } |
| 0 | 317 | | if (galleryName == null) |
| | 318 | | { |
| 0 | 319 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 320 | | } |
| 0 | 321 | | if (gallery == null) |
| | 322 | | { |
| 0 | 323 | | throw new ArgumentNullException(nameof(gallery)); |
| | 324 | | } |
| | 325 | |
|
| 0 | 326 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartUpdate"); |
| 0 | 327 | | scope.Start(); |
| | 328 | | try |
| | 329 | | { |
| 0 | 330 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, galleryName, gallery, cancellatio |
| 0 | 331 | | return new GalleriesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resour |
| | 332 | | } |
| 0 | 333 | | catch (Exception e) |
| | 334 | | { |
| 0 | 335 | | scope.Failed(e); |
| 0 | 336 | | throw; |
| | 337 | | } |
| 0 | 338 | | } |
| | 339 | |
|
| | 340 | | /// <summary> Update a Shared Image Gallery. </summary> |
| | 341 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 342 | | /// <param name="galleryName"> The name of the Shared Image Gallery. The allowed characters are alphabets and nu |
| | 343 | | /// <param name="gallery"> Parameters supplied to the update Shared Image Gallery operation. </param> |
| | 344 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 345 | | public virtual GalleriesUpdateOperation StartUpdate(string resourceGroupName, string galleryName, GalleryUpdate |
| | 346 | | { |
| 0 | 347 | | if (resourceGroupName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 350 | | } |
| 0 | 351 | | if (galleryName == null) |
| | 352 | | { |
| 0 | 353 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 354 | | } |
| 0 | 355 | | if (gallery == null) |
| | 356 | | { |
| 0 | 357 | | throw new ArgumentNullException(nameof(gallery)); |
| | 358 | | } |
| | 359 | |
|
| 0 | 360 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartUpdate"); |
| 0 | 361 | | scope.Start(); |
| | 362 | | try |
| | 363 | | { |
| 0 | 364 | | var originalResponse = RestClient.Update(resourceGroupName, galleryName, gallery, cancellationToken); |
| 0 | 365 | | return new GalleriesUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resour |
| | 366 | | } |
| 0 | 367 | | catch (Exception e) |
| | 368 | | { |
| 0 | 369 | | scope.Failed(e); |
| 0 | 370 | | throw; |
| | 371 | | } |
| 0 | 372 | | } |
| | 373 | |
|
| | 374 | | /// <summary> Delete a Shared Image Gallery. </summary> |
| | 375 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 376 | | /// <param name="galleryName"> The name of the Shared Image Gallery to be deleted. </param> |
| | 377 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 378 | | public virtual async Task<GalleriesDeleteOperation> StartDeleteAsync(string resourceGroupName, string galleryNam |
| | 379 | | { |
| 10 | 380 | | if (resourceGroupName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 383 | | } |
| 10 | 384 | | if (galleryName == null) |
| | 385 | | { |
| 0 | 386 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 387 | | } |
| | 388 | |
|
| 10 | 389 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartDelete"); |
| 10 | 390 | | scope.Start(); |
| | 391 | | try |
| | 392 | | { |
| 10 | 393 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, galleryName, cancellationToken).C |
| 10 | 394 | | return new GalleriesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resour |
| | 395 | | } |
| 0 | 396 | | catch (Exception e) |
| | 397 | | { |
| 0 | 398 | | scope.Failed(e); |
| 0 | 399 | | throw; |
| | 400 | | } |
| 10 | 401 | | } |
| | 402 | |
|
| | 403 | | /// <summary> Delete a Shared Image Gallery. </summary> |
| | 404 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 405 | | /// <param name="galleryName"> The name of the Shared Image Gallery to be deleted. </param> |
| | 406 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 407 | | public virtual GalleriesDeleteOperation StartDelete(string resourceGroupName, string galleryName, CancellationTo |
| | 408 | | { |
| 10 | 409 | | if (resourceGroupName == null) |
| | 410 | | { |
| 0 | 411 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 412 | | } |
| 10 | 413 | | if (galleryName == null) |
| | 414 | | { |
| 0 | 415 | | throw new ArgumentNullException(nameof(galleryName)); |
| | 416 | | } |
| | 417 | |
|
| 10 | 418 | | using var scope = _clientDiagnostics.CreateScope("GalleriesOperations.StartDelete"); |
| 10 | 419 | | scope.Start(); |
| | 420 | | try |
| | 421 | | { |
| 10 | 422 | | var originalResponse = RestClient.Delete(resourceGroupName, galleryName, cancellationToken); |
| 10 | 423 | | return new GalleriesDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resour |
| | 424 | | } |
| 0 | 425 | | catch (Exception e) |
| | 426 | | { |
| 0 | 427 | | scope.Failed(e); |
| 0 | 428 | | throw; |
| | 429 | | } |
| 10 | 430 | | } |
| | 431 | | } |
| | 432 | | } |