| | 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 Disks service client. </summary> |
| | 19 | | public partial class DisksOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 428 | 23 | | internal DisksRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of DisksOperations for mocking. </summary> |
| 396 | 25 | | protected DisksOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of DisksOperations. </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 DisksOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri |
| | 34 | | { |
| 396 | 35 | | RestClient = new DisksRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets information about a disk. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 44 | | public virtual async Task<Response<Disk>> GetAsync(string resourceGroupName, string diskName, CancellationToken |
| | 45 | | { |
| 40 | 46 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.Get"); |
| 40 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 40 | 50 | | return await RestClient.GetAsync(resourceGroupName, diskName, cancellationToken).ConfigureAwait(false); |
| | 51 | | } |
| 8 | 52 | | catch (Exception e) |
| | 53 | | { |
| 8 | 54 | | scope.Failed(e); |
| 8 | 55 | | throw; |
| | 56 | | } |
| 32 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Gets information about a disk. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 62 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 63 | | public virtual Response<Disk> Get(string resourceGroupName, string diskName, CancellationToken cancellationToken |
| | 64 | | { |
| 40 | 65 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.Get"); |
| 40 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 40 | 69 | | return RestClient.Get(resourceGroupName, diskName, cancellationToken); |
| | 70 | | } |
| 8 | 71 | | catch (Exception e) |
| | 72 | | { |
| 8 | 73 | | scope.Failed(e); |
| 8 | 74 | | throw; |
| | 75 | | } |
| 32 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Lists all the disks 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<Disk> ListByResourceGroupAsync(string resourceGroupName, CancellationToken cancella |
| | 82 | | { |
| 8 | 83 | | if (resourceGroupName == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 86 | | } |
| | 87 | |
|
| | 88 | | async Task<Page<Disk>> FirstPageFunc(int? pageSizeHint) |
| | 89 | | { |
| 8 | 90 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.ListByResourceGroup"); |
| 8 | 91 | | scope.Start(); |
| | 92 | | try |
| | 93 | | { |
| 8 | 94 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| 8 | 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 | | } |
| 8 | 102 | | } |
| | 103 | | async Task<Page<Disk>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.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 | | } |
| 8 | 118 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 119 | | } |
| | 120 | |
|
| | 121 | | /// <summary> Lists all the disks 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<Disk> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationToken |
| | 125 | | { |
| 8 | 126 | | if (resourceGroupName == null) |
| | 127 | | { |
| 0 | 128 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 129 | | } |
| | 130 | |
|
| | 131 | | Page<Disk> FirstPageFunc(int? pageSizeHint) |
| | 132 | | { |
| 8 | 133 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.ListByResourceGroup"); |
| 8 | 134 | | scope.Start(); |
| | 135 | | try |
| | 136 | | { |
| 8 | 137 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| 8 | 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 | | } |
| 8 | 145 | | } |
| | 146 | | Page<Disk> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 147 | | { |
| 0 | 148 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.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 | | } |
| 8 | 161 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> Lists all the disks under a subscription. </summary> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public virtual AsyncPageable<Disk> ListAsync(CancellationToken cancellationToken = default) |
| | 167 | | { |
| | 168 | | async Task<Page<Disk>> FirstPageFunc(int? pageSizeHint) |
| | 169 | | { |
| 4 | 170 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.List"); |
| 4 | 171 | | scope.Start(); |
| | 172 | | try |
| | 173 | | { |
| 4 | 174 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| 4 | 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 | | } |
| 4 | 182 | | } |
| | 183 | | async Task<Page<Disk>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 184 | | { |
| 0 | 185 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.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 | | } |
| 4 | 198 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 199 | | } |
| | 200 | |
|
| | 201 | | /// <summary> Lists all the disks under a subscription. </summary> |
| | 202 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 203 | | public virtual Pageable<Disk> List(CancellationToken cancellationToken = default) |
| | 204 | | { |
| | 205 | | Page<Disk> FirstPageFunc(int? pageSizeHint) |
| | 206 | | { |
| 4 | 207 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.List"); |
| 4 | 208 | | scope.Start(); |
| | 209 | | try |
| | 210 | | { |
| 4 | 211 | | var response = RestClient.List(cancellationToken); |
| 4 | 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 | | } |
| 4 | 219 | | } |
| | 220 | | Page<Disk> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 221 | | { |
| 0 | 222 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.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 | | } |
| 4 | 235 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 236 | | } |
| | 237 | |
|
| | 238 | | /// <summary> Creates or updates a disk. </summary> |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 240 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 241 | | /// <param name="disk"> Disk object supplied in the body of the Put disk operation. </param> |
| | 242 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 243 | | public virtual async Task<DisksCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, strin |
| | 244 | | { |
| 46 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 46 | 249 | | if (diskName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(diskName)); |
| | 252 | | } |
| 46 | 253 | | if (disk == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(disk)); |
| | 256 | | } |
| | 257 | |
|
| 46 | 258 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartCreateOrUpdate"); |
| 46 | 259 | | scope.Start(); |
| | 260 | | try |
| | 261 | | { |
| 46 | 262 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, diskName, disk, cancellat |
| 44 | 263 | | return new DisksCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRe |
| | 264 | | } |
| 2 | 265 | | catch (Exception e) |
| | 266 | | { |
| 2 | 267 | | scope.Failed(e); |
| 2 | 268 | | throw; |
| | 269 | | } |
| 44 | 270 | | } |
| | 271 | |
|
| | 272 | | /// <summary> Creates or updates a disk. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 275 | | /// <param name="disk"> Disk object supplied in the body of the Put disk operation. </param> |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public virtual DisksCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string diskName, Disk |
| | 278 | | { |
| 46 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 46 | 283 | | if (diskName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(diskName)); |
| | 286 | | } |
| 46 | 287 | | if (disk == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(disk)); |
| | 290 | | } |
| | 291 | |
|
| 46 | 292 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartCreateOrUpdate"); |
| 46 | 293 | | scope.Start(); |
| | 294 | | try |
| | 295 | | { |
| 46 | 296 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, diskName, disk, cancellationToken); |
| 44 | 297 | | return new DisksCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateRe |
| | 298 | | } |
| 2 | 299 | | catch (Exception e) |
| | 300 | | { |
| 2 | 301 | | scope.Failed(e); |
| 2 | 302 | | throw; |
| | 303 | | } |
| 44 | 304 | | } |
| | 305 | |
|
| | 306 | | /// <summary> Updates (patches) a disk. </summary> |
| | 307 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 308 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 309 | | /// <param name="disk"> Disk object supplied in the body of the Patch disk operation. </param> |
| | 310 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 311 | | public virtual async Task<DisksUpdateOperation> StartUpdateAsync(string resourceGroupName, string diskName, Disk |
| | 312 | | { |
| 6 | 313 | | if (resourceGroupName == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 316 | | } |
| 6 | 317 | | if (diskName == null) |
| | 318 | | { |
| 0 | 319 | | throw new ArgumentNullException(nameof(diskName)); |
| | 320 | | } |
| 6 | 321 | | if (disk == null) |
| | 322 | | { |
| 0 | 323 | | throw new ArgumentNullException(nameof(disk)); |
| | 324 | | } |
| | 325 | |
|
| 6 | 326 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartUpdate"); |
| 6 | 327 | | scope.Start(); |
| | 328 | | try |
| | 329 | | { |
| 6 | 330 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, diskName, disk, cancellationToken |
| 6 | 331 | | return new DisksUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGr |
| | 332 | | } |
| 0 | 333 | | catch (Exception e) |
| | 334 | | { |
| 0 | 335 | | scope.Failed(e); |
| 0 | 336 | | throw; |
| | 337 | | } |
| 6 | 338 | | } |
| | 339 | |
|
| | 340 | | /// <summary> Updates (patches) a disk. </summary> |
| | 341 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 342 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 343 | | /// <param name="disk"> Disk object supplied in the body of the Patch disk operation. </param> |
| | 344 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 345 | | public virtual DisksUpdateOperation StartUpdate(string resourceGroupName, string diskName, DiskUpdate disk, Canc |
| | 346 | | { |
| 6 | 347 | | if (resourceGroupName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 350 | | } |
| 6 | 351 | | if (diskName == null) |
| | 352 | | { |
| 0 | 353 | | throw new ArgumentNullException(nameof(diskName)); |
| | 354 | | } |
| 6 | 355 | | if (disk == null) |
| | 356 | | { |
| 0 | 357 | | throw new ArgumentNullException(nameof(disk)); |
| | 358 | | } |
| | 359 | |
|
| 6 | 360 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartUpdate"); |
| 6 | 361 | | scope.Start(); |
| | 362 | | try |
| | 363 | | { |
| 6 | 364 | | var originalResponse = RestClient.Update(resourceGroupName, diskName, disk, cancellationToken); |
| 6 | 365 | | return new DisksUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resourceGr |
| | 366 | | } |
| 0 | 367 | | catch (Exception e) |
| | 368 | | { |
| 0 | 369 | | scope.Failed(e); |
| 0 | 370 | | throw; |
| | 371 | | } |
| 6 | 372 | | } |
| | 373 | |
|
| | 374 | | /// <summary> Deletes a disk. </summary> |
| | 375 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 376 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 377 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 378 | | public virtual async Task<DisksDeleteOperation> StartDeleteAsync(string resourceGroupName, string diskName, Canc |
| | 379 | | { |
| 18 | 380 | | if (resourceGroupName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 383 | | } |
| 18 | 384 | | if (diskName == null) |
| | 385 | | { |
| 0 | 386 | | throw new ArgumentNullException(nameof(diskName)); |
| | 387 | | } |
| | 388 | |
|
| 18 | 389 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartDelete"); |
| 18 | 390 | | scope.Start(); |
| | 391 | | try |
| | 392 | | { |
| 18 | 393 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, diskName, cancellationToken).Conf |
| 18 | 394 | | return new DisksDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGr |
| | 395 | | } |
| 0 | 396 | | catch (Exception e) |
| | 397 | | { |
| 0 | 398 | | scope.Failed(e); |
| 0 | 399 | | throw; |
| | 400 | | } |
| 18 | 401 | | } |
| | 402 | |
|
| | 403 | | /// <summary> Deletes a disk. </summary> |
| | 404 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 405 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 406 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 407 | | public virtual DisksDeleteOperation StartDelete(string resourceGroupName, string diskName, CancellationToken can |
| | 408 | | { |
| 18 | 409 | | if (resourceGroupName == null) |
| | 410 | | { |
| 0 | 411 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 412 | | } |
| 18 | 413 | | if (diskName == null) |
| | 414 | | { |
| 0 | 415 | | throw new ArgumentNullException(nameof(diskName)); |
| | 416 | | } |
| | 417 | |
|
| 18 | 418 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartDelete"); |
| 18 | 419 | | scope.Start(); |
| | 420 | | try |
| | 421 | | { |
| 18 | 422 | | var originalResponse = RestClient.Delete(resourceGroupName, diskName, cancellationToken); |
| 18 | 423 | | return new DisksDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resourceGr |
| | 424 | | } |
| 0 | 425 | | catch (Exception e) |
| | 426 | | { |
| 0 | 427 | | scope.Failed(e); |
| 0 | 428 | | throw; |
| | 429 | | } |
| 18 | 430 | | } |
| | 431 | |
|
| | 432 | | /// <summary> Grants access to a disk. </summary> |
| | 433 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 434 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 435 | | /// <param name="grantAccessData"> Access data object supplied in the body of the get disk access operation. </p |
| | 436 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 437 | | public virtual async Task<DisksGrantAccessOperation> StartGrantAccessAsync(string resourceGroupName, string disk |
| | 438 | | { |
| 6 | 439 | | if (resourceGroupName == null) |
| | 440 | | { |
| 0 | 441 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 442 | | } |
| 6 | 443 | | if (diskName == null) |
| | 444 | | { |
| 0 | 445 | | throw new ArgumentNullException(nameof(diskName)); |
| | 446 | | } |
| 6 | 447 | | if (grantAccessData == null) |
| | 448 | | { |
| 0 | 449 | | throw new ArgumentNullException(nameof(grantAccessData)); |
| | 450 | | } |
| | 451 | |
|
| 6 | 452 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartGrantAccess"); |
| 6 | 453 | | scope.Start(); |
| | 454 | | try |
| | 455 | | { |
| 6 | 456 | | var originalResponse = await RestClient.GrantAccessAsync(resourceGroupName, diskName, grantAccessData, c |
| 6 | 457 | | return new DisksGrantAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateGrantAccessRequest( |
| | 458 | | } |
| 0 | 459 | | catch (Exception e) |
| | 460 | | { |
| 0 | 461 | | scope.Failed(e); |
| 0 | 462 | | throw; |
| | 463 | | } |
| 6 | 464 | | } |
| | 465 | |
|
| | 466 | | /// <summary> Grants access to a disk. </summary> |
| | 467 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 468 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 469 | | /// <param name="grantAccessData"> Access data object supplied in the body of the get disk access operation. </p |
| | 470 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 471 | | public virtual DisksGrantAccessOperation StartGrantAccess(string resourceGroupName, string diskName, GrantAccess |
| | 472 | | { |
| 6 | 473 | | if (resourceGroupName == null) |
| | 474 | | { |
| 0 | 475 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 476 | | } |
| 6 | 477 | | if (diskName == null) |
| | 478 | | { |
| 0 | 479 | | throw new ArgumentNullException(nameof(diskName)); |
| | 480 | | } |
| 6 | 481 | | if (grantAccessData == null) |
| | 482 | | { |
| 0 | 483 | | throw new ArgumentNullException(nameof(grantAccessData)); |
| | 484 | | } |
| | 485 | |
|
| 6 | 486 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartGrantAccess"); |
| 6 | 487 | | scope.Start(); |
| | 488 | | try |
| | 489 | | { |
| 6 | 490 | | var originalResponse = RestClient.GrantAccess(resourceGroupName, diskName, grantAccessData, cancellation |
| 6 | 491 | | return new DisksGrantAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateGrantAccessRequest( |
| | 492 | | } |
| 0 | 493 | | catch (Exception e) |
| | 494 | | { |
| 0 | 495 | | scope.Failed(e); |
| 0 | 496 | | throw; |
| | 497 | | } |
| 6 | 498 | | } |
| | 499 | |
|
| | 500 | | /// <summary> Revokes access to a disk. </summary> |
| | 501 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 502 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 503 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 504 | | public virtual async Task<DisksRevokeAccessOperation> StartRevokeAccessAsync(string resourceGroupName, string di |
| | 505 | | { |
| 6 | 506 | | if (resourceGroupName == null) |
| | 507 | | { |
| 0 | 508 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 509 | | } |
| 6 | 510 | | if (diskName == null) |
| | 511 | | { |
| 0 | 512 | | throw new ArgumentNullException(nameof(diskName)); |
| | 513 | | } |
| | 514 | |
|
| 6 | 515 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartRevokeAccess"); |
| 6 | 516 | | scope.Start(); |
| | 517 | | try |
| | 518 | | { |
| 6 | 519 | | var originalResponse = await RestClient.RevokeAccessAsync(resourceGroupName, diskName, cancellationToken |
| 6 | 520 | | return new DisksRevokeAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevokeAccessReques |
| | 521 | | } |
| 0 | 522 | | catch (Exception e) |
| | 523 | | { |
| 0 | 524 | | scope.Failed(e); |
| 0 | 525 | | throw; |
| | 526 | | } |
| 6 | 527 | | } |
| | 528 | |
|
| | 529 | | /// <summary> Revokes access to a disk. </summary> |
| | 530 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 531 | | /// <param name="diskName"> The name of the managed disk that is being created. The name can't be changed a |
| | 532 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 533 | | public virtual DisksRevokeAccessOperation StartRevokeAccess(string resourceGroupName, string diskName, Cancellat |
| | 534 | | { |
| 6 | 535 | | if (resourceGroupName == null) |
| | 536 | | { |
| 0 | 537 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 538 | | } |
| 6 | 539 | | if (diskName == null) |
| | 540 | | { |
| 0 | 541 | | throw new ArgumentNullException(nameof(diskName)); |
| | 542 | | } |
| | 543 | |
|
| 6 | 544 | | using var scope = _clientDiagnostics.CreateScope("DisksOperations.StartRevokeAccess"); |
| 6 | 545 | | scope.Start(); |
| | 546 | | try |
| | 547 | | { |
| 6 | 548 | | var originalResponse = RestClient.RevokeAccess(resourceGroupName, diskName, cancellationToken); |
| 6 | 549 | | return new DisksRevokeAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevokeAccessReques |
| | 550 | | } |
| 0 | 551 | | catch (Exception e) |
| | 552 | | { |
| 0 | 553 | | scope.Failed(e); |
| 0 | 554 | | throw; |
| | 555 | | } |
| 6 | 556 | | } |
| | 557 | | } |
| | 558 | | } |