| | 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 Snapshots service client. </summary> |
| | 19 | | public partial class SnapshotsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 156 | 23 | | internal SnapshotsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of SnapshotsOperations for mocking. </summary> |
| 396 | 25 | | protected SnapshotsOperations() |
| | 26 | | { |
| 396 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of SnapshotsOperations. </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 SnapshotsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, |
| | 34 | | { |
| 396 | 35 | | RestClient = new SnapshotsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint); |
| 396 | 36 | | _clientDiagnostics = clientDiagnostics; |
| 396 | 37 | | _pipeline = pipeline; |
| 396 | 38 | | } |
| | 39 | |
|
| | 40 | | /// <summary> Gets information about a snapshot. </summary> |
| | 41 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 42 | | /// <param name="snapshotName"> The name of the snapshot 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<Snapshot>> GetAsync(string resourceGroupName, string snapshotName, Cancellati |
| | 45 | | { |
| 16 | 46 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.Get"); |
| 16 | 47 | | scope.Start(); |
| | 48 | | try |
| | 49 | | { |
| 16 | 50 | | return await RestClient.GetAsync(resourceGroupName, snapshotName, cancellationToken).ConfigureAwait(fals |
| | 51 | | } |
| 4 | 52 | | catch (Exception e) |
| | 53 | | { |
| 4 | 54 | | scope.Failed(e); |
| 4 | 55 | | throw; |
| | 56 | | } |
| 12 | 57 | | } |
| | 58 | |
|
| | 59 | | /// <summary> Gets information about a snapshot. </summary> |
| | 60 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 61 | | /// <param name="snapshotName"> The name of the snapshot 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<Snapshot> Get(string resourceGroupName, string snapshotName, CancellationToken cancellat |
| | 64 | | { |
| 16 | 65 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.Get"); |
| 16 | 66 | | scope.Start(); |
| | 67 | | try |
| | 68 | | { |
| 16 | 69 | | return RestClient.Get(resourceGroupName, snapshotName, cancellationToken); |
| | 70 | | } |
| 4 | 71 | | catch (Exception e) |
| | 72 | | { |
| 4 | 73 | | scope.Failed(e); |
| 4 | 74 | | throw; |
| | 75 | | } |
| 12 | 76 | | } |
| | 77 | |
|
| | 78 | | /// <summary> Lists snapshots 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<Snapshot> ListByResourceGroupAsync(string resourceGroupName, CancellationToken canc |
| | 82 | | { |
| 4 | 83 | | if (resourceGroupName == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 86 | | } |
| | 87 | |
|
| | 88 | | async Task<Page<Snapshot>> FirstPageFunc(int? pageSizeHint) |
| | 89 | | { |
| 4 | 90 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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<Snapshot>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 104 | | { |
| 0 | 105 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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> Lists snapshots 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<Snapshot> ListByResourceGroup(string resourceGroupName, CancellationToken cancellationTo |
| | 125 | | { |
| 4 | 126 | | if (resourceGroupName == null) |
| | 127 | | { |
| 0 | 128 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 129 | | } |
| | 130 | |
|
| | 131 | | Page<Snapshot> FirstPageFunc(int? pageSizeHint) |
| | 132 | | { |
| 4 | 133 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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<Snapshot> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 147 | | { |
| 0 | 148 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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> Lists snapshots under a subscription. </summary> |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public virtual AsyncPageable<Snapshot> ListAsync(CancellationToken cancellationToken = default) |
| | 167 | | { |
| | 168 | | async Task<Page<Snapshot>> FirstPageFunc(int? pageSizeHint) |
| | 169 | | { |
| 2 | 170 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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<Snapshot>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 184 | | { |
| 0 | 185 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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> Lists snapshots under a subscription. </summary> |
| | 202 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 203 | | public virtual Pageable<Snapshot> List(CancellationToken cancellationToken = default) |
| | 204 | | { |
| | 205 | | Page<Snapshot> FirstPageFunc(int? pageSizeHint) |
| | 206 | | { |
| 2 | 207 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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<Snapshot> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 221 | | { |
| 0 | 222 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.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> Creates or updates a snapshot. </summary> |
| | 239 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 240 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 241 | | /// <param name="snapshot"> Snapshot 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<SnapshotsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, s |
| | 244 | | { |
| 12 | 245 | | if (resourceGroupName == null) |
| | 246 | | { |
| 0 | 247 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 248 | | } |
| 12 | 249 | | if (snapshotName == null) |
| | 250 | | { |
| 0 | 251 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 252 | | } |
| 12 | 253 | | if (snapshot == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(snapshot)); |
| | 256 | | } |
| | 257 | |
|
| 12 | 258 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartCreateOrUpdate"); |
| 12 | 259 | | scope.Start(); |
| | 260 | | try |
| | 261 | | { |
| 12 | 262 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, snapshotName, snapshot, c |
| 12 | 263 | | return new SnapshotsCreateOrUpdateOperation(_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> Creates or updates a snapshot. </summary> |
| | 273 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 274 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 275 | | /// <param name="snapshot"> Snapshot object supplied in the body of the Put disk operation. </param> |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | public virtual SnapshotsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string snapshotNam |
| | 278 | | { |
| 12 | 279 | | if (resourceGroupName == null) |
| | 280 | | { |
| 0 | 281 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 282 | | } |
| 12 | 283 | | if (snapshotName == null) |
| | 284 | | { |
| 0 | 285 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 286 | | } |
| 12 | 287 | | if (snapshot == null) |
| | 288 | | { |
| 0 | 289 | | throw new ArgumentNullException(nameof(snapshot)); |
| | 290 | | } |
| | 291 | |
|
| 12 | 292 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartCreateOrUpdate"); |
| 12 | 293 | | scope.Start(); |
| | 294 | | try |
| | 295 | | { |
| 12 | 296 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, snapshotName, snapshot, cancellation |
| 12 | 297 | | return new SnapshotsCreateOrUpdateOperation(_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> Updates (patches) a snapshot. </summary> |
| | 307 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 308 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 309 | | /// <param name="snapshot"> Snapshot object supplied in the body of the Patch snapshot operation. </param> |
| | 310 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 311 | | public virtual async Task<SnapshotsUpdateOperation> StartUpdateAsync(string resourceGroupName, string snapshotNa |
| | 312 | | { |
| 4 | 313 | | if (resourceGroupName == null) |
| | 314 | | { |
| 0 | 315 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 316 | | } |
| 4 | 317 | | if (snapshotName == null) |
| | 318 | | { |
| 0 | 319 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 320 | | } |
| 4 | 321 | | if (snapshot == null) |
| | 322 | | { |
| 0 | 323 | | throw new ArgumentNullException(nameof(snapshot)); |
| | 324 | | } |
| | 325 | |
|
| 4 | 326 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartUpdate"); |
| 4 | 327 | | scope.Start(); |
| | 328 | | try |
| | 329 | | { |
| 4 | 330 | | var originalResponse = await RestClient.UpdateAsync(resourceGroupName, snapshotName, snapshot, cancellat |
| 4 | 331 | | return new SnapshotsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resour |
| | 332 | | } |
| 0 | 333 | | catch (Exception e) |
| | 334 | | { |
| 0 | 335 | | scope.Failed(e); |
| 0 | 336 | | throw; |
| | 337 | | } |
| 4 | 338 | | } |
| | 339 | |
|
| | 340 | | /// <summary> Updates (patches) a snapshot. </summary> |
| | 341 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 342 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 343 | | /// <param name="snapshot"> Snapshot object supplied in the body of the Patch snapshot operation. </param> |
| | 344 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 345 | | public virtual SnapshotsUpdateOperation StartUpdate(string resourceGroupName, string snapshotName, SnapshotUpdat |
| | 346 | | { |
| 4 | 347 | | if (resourceGroupName == null) |
| | 348 | | { |
| 0 | 349 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 350 | | } |
| 4 | 351 | | if (snapshotName == null) |
| | 352 | | { |
| 0 | 353 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 354 | | } |
| 4 | 355 | | if (snapshot == null) |
| | 356 | | { |
| 0 | 357 | | throw new ArgumentNullException(nameof(snapshot)); |
| | 358 | | } |
| | 359 | |
|
| 4 | 360 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartUpdate"); |
| 4 | 361 | | scope.Start(); |
| | 362 | | try |
| | 363 | | { |
| 4 | 364 | | var originalResponse = RestClient.Update(resourceGroupName, snapshotName, snapshot, cancellationToken); |
| 4 | 365 | | return new SnapshotsUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateUpdateRequest(resour |
| | 366 | | } |
| 0 | 367 | | catch (Exception e) |
| | 368 | | { |
| 0 | 369 | | scope.Failed(e); |
| 0 | 370 | | throw; |
| | 371 | | } |
| 4 | 372 | | } |
| | 373 | |
|
| | 374 | | /// <summary> Deletes a snapshot. </summary> |
| | 375 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 376 | | /// <param name="snapshotName"> The name of the snapshot 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<SnapshotsDeleteOperation> StartDeleteAsync(string resourceGroupName, string snapshotNa |
| | 379 | | { |
| 4 | 380 | | if (resourceGroupName == null) |
| | 381 | | { |
| 0 | 382 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 383 | | } |
| 4 | 384 | | if (snapshotName == null) |
| | 385 | | { |
| 0 | 386 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 387 | | } |
| | 388 | |
|
| 4 | 389 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartDelete"); |
| 4 | 390 | | scope.Start(); |
| | 391 | | try |
| | 392 | | { |
| 4 | 393 | | var originalResponse = await RestClient.DeleteAsync(resourceGroupName, snapshotName, cancellationToken). |
| 4 | 394 | | return new SnapshotsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resour |
| | 395 | | } |
| 0 | 396 | | catch (Exception e) |
| | 397 | | { |
| 0 | 398 | | scope.Failed(e); |
| 0 | 399 | | throw; |
| | 400 | | } |
| 4 | 401 | | } |
| | 402 | |
|
| | 403 | | /// <summary> Deletes a snapshot. </summary> |
| | 404 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 405 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 406 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 407 | | public virtual SnapshotsDeleteOperation StartDelete(string resourceGroupName, string snapshotName, CancellationT |
| | 408 | | { |
| 4 | 409 | | if (resourceGroupName == null) |
| | 410 | | { |
| 0 | 411 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 412 | | } |
| 4 | 413 | | if (snapshotName == null) |
| | 414 | | { |
| 0 | 415 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 416 | | } |
| | 417 | |
|
| 4 | 418 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartDelete"); |
| 4 | 419 | | scope.Start(); |
| | 420 | | try |
| | 421 | | { |
| 4 | 422 | | var originalResponse = RestClient.Delete(resourceGroupName, snapshotName, cancellationToken); |
| 4 | 423 | | return new SnapshotsDeleteOperation(_clientDiagnostics, _pipeline, RestClient.CreateDeleteRequest(resour |
| | 424 | | } |
| 0 | 425 | | catch (Exception e) |
| | 426 | | { |
| 0 | 427 | | scope.Failed(e); |
| 0 | 428 | | throw; |
| | 429 | | } |
| 4 | 430 | | } |
| | 431 | |
|
| | 432 | | /// <summary> Grants access to a snapshot. </summary> |
| | 433 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 434 | | /// <param name="snapshotName"> The name of the snapshot 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 snapshot access operation. |
| | 436 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 437 | | public virtual async Task<SnapshotsGrantAccessOperation> StartGrantAccessAsync(string resourceGroupName, string |
| | 438 | | { |
| 4 | 439 | | if (resourceGroupName == null) |
| | 440 | | { |
| 0 | 441 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 442 | | } |
| 4 | 443 | | if (snapshotName == null) |
| | 444 | | { |
| 0 | 445 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 446 | | } |
| 4 | 447 | | if (grantAccessData == null) |
| | 448 | | { |
| 0 | 449 | | throw new ArgumentNullException(nameof(grantAccessData)); |
| | 450 | | } |
| | 451 | |
|
| 4 | 452 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartGrantAccess"); |
| 4 | 453 | | scope.Start(); |
| | 454 | | try |
| | 455 | | { |
| 4 | 456 | | var originalResponse = await RestClient.GrantAccessAsync(resourceGroupName, snapshotName, grantAccessDat |
| 4 | 457 | | return new SnapshotsGrantAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateGrantAccessRequ |
| | 458 | | } |
| 0 | 459 | | catch (Exception e) |
| | 460 | | { |
| 0 | 461 | | scope.Failed(e); |
| 0 | 462 | | throw; |
| | 463 | | } |
| 4 | 464 | | } |
| | 465 | |
|
| | 466 | | /// <summary> Grants access to a snapshot. </summary> |
| | 467 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 468 | | /// <param name="snapshotName"> The name of the snapshot 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 snapshot access operation. |
| | 470 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 471 | | public virtual SnapshotsGrantAccessOperation StartGrantAccess(string resourceGroupName, string snapshotName, Gra |
| | 472 | | { |
| 4 | 473 | | if (resourceGroupName == null) |
| | 474 | | { |
| 0 | 475 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 476 | | } |
| 4 | 477 | | if (snapshotName == null) |
| | 478 | | { |
| 0 | 479 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 480 | | } |
| 4 | 481 | | if (grantAccessData == null) |
| | 482 | | { |
| 0 | 483 | | throw new ArgumentNullException(nameof(grantAccessData)); |
| | 484 | | } |
| | 485 | |
|
| 4 | 486 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartGrantAccess"); |
| 4 | 487 | | scope.Start(); |
| | 488 | | try |
| | 489 | | { |
| 4 | 490 | | var originalResponse = RestClient.GrantAccess(resourceGroupName, snapshotName, grantAccessData, cancella |
| 4 | 491 | | return new SnapshotsGrantAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateGrantAccessRequ |
| | 492 | | } |
| 0 | 493 | | catch (Exception e) |
| | 494 | | { |
| 0 | 495 | | scope.Failed(e); |
| 0 | 496 | | throw; |
| | 497 | | } |
| 4 | 498 | | } |
| | 499 | |
|
| | 500 | | /// <summary> Revokes access to a snapshot. </summary> |
| | 501 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 502 | | /// <param name="snapshotName"> The name of the snapshot 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<SnapshotsRevokeAccessOperation> StartRevokeAccessAsync(string resourceGroupName, strin |
| | 505 | | { |
| 4 | 506 | | if (resourceGroupName == null) |
| | 507 | | { |
| 0 | 508 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 509 | | } |
| 4 | 510 | | if (snapshotName == null) |
| | 511 | | { |
| 0 | 512 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 513 | | } |
| | 514 | |
|
| 4 | 515 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartRevokeAccess"); |
| 4 | 516 | | scope.Start(); |
| | 517 | | try |
| | 518 | | { |
| 4 | 519 | | var originalResponse = await RestClient.RevokeAccessAsync(resourceGroupName, snapshotName, cancellationT |
| 4 | 520 | | return new SnapshotsRevokeAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevokeAccessRe |
| | 521 | | } |
| 0 | 522 | | catch (Exception e) |
| | 523 | | { |
| 0 | 524 | | scope.Failed(e); |
| 0 | 525 | | throw; |
| | 526 | | } |
| 4 | 527 | | } |
| | 528 | |
|
| | 529 | | /// <summary> Revokes access to a snapshot. </summary> |
| | 530 | | /// <param name="resourceGroupName"> The name of the resource group. </param> |
| | 531 | | /// <param name="snapshotName"> The name of the snapshot that is being created. The name can't be changed a |
| | 532 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 533 | | public virtual SnapshotsRevokeAccessOperation StartRevokeAccess(string resourceGroupName, string snapshotName, C |
| | 534 | | { |
| 4 | 535 | | if (resourceGroupName == null) |
| | 536 | | { |
| 0 | 537 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 538 | | } |
| 4 | 539 | | if (snapshotName == null) |
| | 540 | | { |
| 0 | 541 | | throw new ArgumentNullException(nameof(snapshotName)); |
| | 542 | | } |
| | 543 | |
|
| 4 | 544 | | using var scope = _clientDiagnostics.CreateScope("SnapshotsOperations.StartRevokeAccess"); |
| 4 | 545 | | scope.Start(); |
| | 546 | | try |
| | 547 | | { |
| 4 | 548 | | var originalResponse = RestClient.RevokeAccess(resourceGroupName, snapshotName, cancellationToken); |
| 4 | 549 | | return new SnapshotsRevokeAccessOperation(_clientDiagnostics, _pipeline, RestClient.CreateRevokeAccessRe |
| | 550 | | } |
| 0 | 551 | | catch (Exception e) |
| | 552 | | { |
| 0 | 553 | | scope.Failed(e); |
| 0 | 554 | | throw; |
| | 555 | | } |
| 4 | 556 | | } |
| | 557 | | } |
| | 558 | | } |