| | 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.KeyVault.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.KeyVault |
| | 17 | | { |
| | 18 | | /// <summary> The Vaults service client. </summary> |
| | 19 | | public partial class VaultsOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 240 | 23 | | internal VaultsRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of VaultsOperations for mocking. </summary> |
| 24 | 25 | | protected VaultsOperations() |
| | 26 | | { |
| 24 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of VaultsOperations. </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> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 24 | 34 | | internal VaultsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri |
| | 35 | | { |
| 24 | 36 | | RestClient = new VaultsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); |
| 24 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 24 | 38 | | _pipeline = pipeline; |
| 24 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Update a key vault in the specified subscription. </summary> |
| | 42 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 43 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 44 | | /// <param name="parameters"> Parameters to patch the vault. </param> |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<Vault>> UpdateAsync(string resourceGroupName, string vaultName, VaultPatchPar |
| | 47 | | { |
| 0 | 48 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Update"); |
| 0 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 0 | 52 | | return await RestClient.UpdateAsync(resourceGroupName, vaultName, parameters, cancellationToken).Configu |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 0 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Update a key vault in the specified subscription. </summary> |
| | 62 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 63 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 64 | | /// <param name="parameters"> Parameters to patch the vault. </param> |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public virtual Response<Vault> Update(string resourceGroupName, string vaultName, VaultPatchParameters parameter |
| | 67 | | { |
| 0 | 68 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Update"); |
| 0 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 0 | 72 | | return RestClient.Update(resourceGroupName, vaultName, parameters, cancellationToken); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> Deletes the specified Azure key vault. </summary> |
| | 82 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 83 | | /// <param name="vaultName"> The name of the vault to delete. </param> |
| | 84 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 85 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string vaultName, CancellationToken ca |
| | 86 | | { |
| 24 | 87 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Delete"); |
| 24 | 88 | | scope.Start(); |
| | 89 | | try |
| | 90 | | { |
| 24 | 91 | | return await RestClient.DeleteAsync(resourceGroupName, vaultName, cancellationToken).ConfigureAwait(fals |
| | 92 | | } |
| 0 | 93 | | catch (Exception e) |
| | 94 | | { |
| 0 | 95 | | scope.Failed(e); |
| 0 | 96 | | throw; |
| | 97 | | } |
| 24 | 98 | | } |
| | 99 | |
|
| | 100 | | /// <summary> Deletes the specified Azure key vault. </summary> |
| | 101 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 102 | | /// <param name="vaultName"> The name of the vault to delete. </param> |
| | 103 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 104 | | public virtual Response Delete(string resourceGroupName, string vaultName, CancellationToken cancellationToken = |
| | 105 | | { |
| 24 | 106 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Delete"); |
| 24 | 107 | | scope.Start(); |
| | 108 | | try |
| | 109 | | { |
| 24 | 110 | | return RestClient.Delete(resourceGroupName, vaultName, cancellationToken); |
| | 111 | | } |
| 0 | 112 | | catch (Exception e) |
| | 113 | | { |
| 0 | 114 | | scope.Failed(e); |
| 0 | 115 | | throw; |
| | 116 | | } |
| 24 | 117 | | } |
| | 118 | |
|
| | 119 | | /// <summary> Gets the specified Azure key vault. </summary> |
| | 120 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 121 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 122 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 123 | | public virtual async Task<Response<Vault>> GetAsync(string resourceGroupName, string vaultName, CancellationToke |
| | 124 | | { |
| 14 | 125 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Get"); |
| 14 | 126 | | scope.Start(); |
| | 127 | | try |
| | 128 | | { |
| 14 | 129 | | return await RestClient.GetAsync(resourceGroupName, vaultName, cancellationToken).ConfigureAwait(false); |
| | 130 | | } |
| 6 | 131 | | catch (Exception e) |
| | 132 | | { |
| 6 | 133 | | scope.Failed(e); |
| 6 | 134 | | throw; |
| | 135 | | } |
| 8 | 136 | | } |
| | 137 | |
|
| | 138 | | /// <summary> Gets the specified Azure key vault. </summary> |
| | 139 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 140 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 141 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 142 | | public virtual Response<Vault> Get(string resourceGroupName, string vaultName, CancellationToken cancellationTok |
| | 143 | | { |
| 14 | 144 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.Get"); |
| 14 | 145 | | scope.Start(); |
| | 146 | | try |
| | 147 | | { |
| 14 | 148 | | return RestClient.Get(resourceGroupName, vaultName, cancellationToken); |
| | 149 | | } |
| 6 | 150 | | catch (Exception e) |
| | 151 | | { |
| 6 | 152 | | scope.Failed(e); |
| 6 | 153 | | throw; |
| | 154 | | } |
| 8 | 155 | | } |
| | 156 | |
|
| | 157 | | /// <summary> Update access policies in a key vault in the specified subscription. </summary> |
| | 158 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 159 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 160 | | /// <param name="operationKind"> Name of the operation. </param> |
| | 161 | | /// <param name="parameters"> Access policy to merge into the vault. </param> |
| | 162 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 163 | | public virtual async Task<Response<VaultAccessPolicyParameters>> UpdateAccessPolicyAsync(string resourceGroupNam |
| | 164 | | { |
| 0 | 165 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.UpdateAccessPolicy"); |
| 0 | 166 | | scope.Start(); |
| | 167 | | try |
| | 168 | | { |
| 0 | 169 | | return await RestClient.UpdateAccessPolicyAsync(resourceGroupName, vaultName, operationKind, parameters, |
| | 170 | | } |
| 0 | 171 | | catch (Exception e) |
| | 172 | | { |
| 0 | 173 | | scope.Failed(e); |
| 0 | 174 | | throw; |
| | 175 | | } |
| 0 | 176 | | } |
| | 177 | |
|
| | 178 | | /// <summary> Update access policies in a key vault in the specified subscription. </summary> |
| | 179 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 180 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 181 | | /// <param name="operationKind"> Name of the operation. </param> |
| | 182 | | /// <param name="parameters"> Access policy to merge into the vault. </param> |
| | 183 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 184 | | public virtual Response<VaultAccessPolicyParameters> UpdateAccessPolicy(string resourceGroupName, string vaultNa |
| | 185 | | { |
| 0 | 186 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.UpdateAccessPolicy"); |
| 0 | 187 | | scope.Start(); |
| | 188 | | try |
| | 189 | | { |
| 0 | 190 | | return RestClient.UpdateAccessPolicy(resourceGroupName, vaultName, operationKind, parameters, cancellati |
| | 191 | | } |
| 0 | 192 | | catch (Exception e) |
| | 193 | | { |
| 0 | 194 | | scope.Failed(e); |
| 0 | 195 | | throw; |
| | 196 | | } |
| 0 | 197 | | } |
| | 198 | |
|
| | 199 | | /// <summary> Gets the deleted Azure key vault. </summary> |
| | 200 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 201 | | /// <param name="location"> The location of the deleted vault. </param> |
| | 202 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 203 | | public virtual async Task<Response<DeletedVault>> GetDeletedAsync(string vaultName, string location, Cancellatio |
| | 204 | | { |
| 12 | 205 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.GetDeleted"); |
| 12 | 206 | | scope.Start(); |
| | 207 | | try |
| | 208 | | { |
| 12 | 209 | | return await RestClient.GetDeletedAsync(vaultName, location, cancellationToken).ConfigureAwait(false); |
| | 210 | | } |
| 6 | 211 | | catch (Exception e) |
| | 212 | | { |
| 6 | 213 | | scope.Failed(e); |
| 6 | 214 | | throw; |
| | 215 | | } |
| 6 | 216 | | } |
| | 217 | |
|
| | 218 | | /// <summary> Gets the deleted Azure key vault. </summary> |
| | 219 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 220 | | /// <param name="location"> The location of the deleted vault. </param> |
| | 221 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 222 | | public virtual Response<DeletedVault> GetDeleted(string vaultName, string location, CancellationToken cancellati |
| | 223 | | { |
| 12 | 224 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.GetDeleted"); |
| 12 | 225 | | scope.Start(); |
| | 226 | | try |
| | 227 | | { |
| 12 | 228 | | return RestClient.GetDeleted(vaultName, location, cancellationToken); |
| | 229 | | } |
| 6 | 230 | | catch (Exception e) |
| | 231 | | { |
| 6 | 232 | | scope.Failed(e); |
| 6 | 233 | | throw; |
| | 234 | | } |
| 6 | 235 | | } |
| | 236 | |
|
| | 237 | | /// <summary> Checks that the vault name is valid and is not already in use. </summary> |
| | 238 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 239 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 240 | | public virtual async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(VaultCheckNameAvaila |
| | 241 | | { |
| 0 | 242 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.CheckNameAvailability"); |
| 0 | 243 | | scope.Start(); |
| | 244 | | try |
| | 245 | | { |
| 0 | 246 | | return await RestClient.CheckNameAvailabilityAsync(vaultName, cancellationToken).ConfigureAwait(false); |
| | 247 | | } |
| 0 | 248 | | catch (Exception e) |
| | 249 | | { |
| 0 | 250 | | scope.Failed(e); |
| 0 | 251 | | throw; |
| | 252 | | } |
| 0 | 253 | | } |
| | 254 | |
|
| | 255 | | /// <summary> Checks that the vault name is valid and is not already in use. </summary> |
| | 256 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 257 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 258 | | public virtual Response<CheckNameAvailabilityResult> CheckNameAvailability(VaultCheckNameAvailabilityParameters |
| | 259 | | { |
| 0 | 260 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.CheckNameAvailability"); |
| 0 | 261 | | scope.Start(); |
| | 262 | | try |
| | 263 | | { |
| 0 | 264 | | return RestClient.CheckNameAvailability(vaultName, cancellationToken); |
| | 265 | | } |
| 0 | 266 | | catch (Exception e) |
| | 267 | | { |
| 0 | 268 | | scope.Failed(e); |
| 0 | 269 | | throw; |
| | 270 | | } |
| 0 | 271 | | } |
| | 272 | |
|
| | 273 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 274 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 275 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 276 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 277 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception> |
| | 278 | | public virtual AsyncPageable<Vault> ListByResourceGroupAsync(string resourceGroupName, int? top = null, Cancella |
| | 279 | | { |
| 2 | 280 | | if (resourceGroupName == null) |
| | 281 | | { |
| 0 | 282 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 283 | | } |
| | 284 | |
|
| | 285 | | async Task<Page<Vault>> FirstPageFunc(int? pageSizeHint) |
| | 286 | | { |
| 2 | 287 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup"); |
| 2 | 288 | | scope.Start(); |
| | 289 | | try |
| | 290 | | { |
| 2 | 291 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, top, cancellationToken). |
| 2 | 292 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 293 | | } |
| 0 | 294 | | catch (Exception e) |
| | 295 | | { |
| 0 | 296 | | scope.Failed(e); |
| 0 | 297 | | throw; |
| | 298 | | } |
| 2 | 299 | | } |
| | 300 | | async Task<Page<Vault>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 301 | | { |
| 2 | 302 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup"); |
| 2 | 303 | | scope.Start(); |
| | 304 | | try |
| | 305 | | { |
| 2 | 306 | | var response = await RestClient.ListByResourceGroupNextPageAsync(nextLink, resourceGroupName, top, c |
| 2 | 307 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 308 | | } |
| 0 | 309 | | catch (Exception e) |
| | 310 | | { |
| 0 | 311 | | scope.Failed(e); |
| 0 | 312 | | throw; |
| | 313 | | } |
| 2 | 314 | | } |
| 2 | 315 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 316 | | } |
| | 317 | |
|
| | 318 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 319 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 320 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 321 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 322 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception> |
| | 323 | | public virtual Pageable<Vault> ListByResourceGroup(string resourceGroupName, int? top = null, CancellationToken |
| | 324 | | { |
| 2 | 325 | | if (resourceGroupName == null) |
| | 326 | | { |
| 0 | 327 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 328 | | } |
| | 329 | |
|
| | 330 | | Page<Vault> FirstPageFunc(int? pageSizeHint) |
| | 331 | | { |
| 2 | 332 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup"); |
| 2 | 333 | | scope.Start(); |
| | 334 | | try |
| | 335 | | { |
| 2 | 336 | | var response = RestClient.ListByResourceGroup(resourceGroupName, top, cancellationToken); |
| 2 | 337 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 338 | | } |
| 0 | 339 | | catch (Exception e) |
| | 340 | | { |
| 0 | 341 | | scope.Failed(e); |
| 0 | 342 | | throw; |
| | 343 | | } |
| 2 | 344 | | } |
| | 345 | | Page<Vault> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 346 | | { |
| 2 | 347 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListByResourceGroup"); |
| 2 | 348 | | scope.Start(); |
| | 349 | | try |
| | 350 | | { |
| 2 | 351 | | var response = RestClient.ListByResourceGroupNextPage(nextLink, resourceGroupName, top, cancellation |
| 2 | 352 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 353 | | } |
| 0 | 354 | | catch (Exception e) |
| | 355 | | { |
| 0 | 356 | | scope.Failed(e); |
| 0 | 357 | | throw; |
| | 358 | | } |
| 2 | 359 | | } |
| 2 | 360 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 361 | | } |
| | 362 | |
|
| | 363 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 364 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 365 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 366 | | public virtual AsyncPageable<Vault> ListBySubscriptionAsync(int? top = null, CancellationToken cancellationToken |
| | 367 | | { |
| | 368 | | async Task<Page<Vault>> FirstPageFunc(int? pageSizeHint) |
| | 369 | | { |
| 0 | 370 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription"); |
| 0 | 371 | | scope.Start(); |
| | 372 | | try |
| | 373 | | { |
| 0 | 374 | | var response = await RestClient.ListBySubscriptionAsync(top, cancellationToken).ConfigureAwait(false |
| 0 | 375 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 376 | | } |
| 0 | 377 | | catch (Exception e) |
| | 378 | | { |
| 0 | 379 | | scope.Failed(e); |
| 0 | 380 | | throw; |
| | 381 | | } |
| 0 | 382 | | } |
| | 383 | | async Task<Page<Vault>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 384 | | { |
| 0 | 385 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription"); |
| 0 | 386 | | scope.Start(); |
| | 387 | | try |
| | 388 | | { |
| 0 | 389 | | var response = await RestClient.ListBySubscriptionNextPageAsync(nextLink, top, cancellationToken).Co |
| 0 | 390 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 391 | | } |
| 0 | 392 | | catch (Exception e) |
| | 393 | | { |
| 0 | 394 | | scope.Failed(e); |
| 0 | 395 | | throw; |
| | 396 | | } |
| 0 | 397 | | } |
| 0 | 398 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 399 | | } |
| | 400 | |
|
| | 401 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 402 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 403 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 404 | | public virtual Pageable<Vault> ListBySubscription(int? top = null, CancellationToken cancellationToken = default |
| | 405 | | { |
| | 406 | | Page<Vault> FirstPageFunc(int? pageSizeHint) |
| | 407 | | { |
| 0 | 408 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription"); |
| 0 | 409 | | scope.Start(); |
| | 410 | | try |
| | 411 | | { |
| 0 | 412 | | var response = RestClient.ListBySubscription(top, cancellationToken); |
| 0 | 413 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 414 | | } |
| 0 | 415 | | catch (Exception e) |
| | 416 | | { |
| 0 | 417 | | scope.Failed(e); |
| 0 | 418 | | throw; |
| | 419 | | } |
| 0 | 420 | | } |
| | 421 | | Page<Vault> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 422 | | { |
| 0 | 423 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListBySubscription"); |
| 0 | 424 | | scope.Start(); |
| | 425 | | try |
| | 426 | | { |
| 0 | 427 | | var response = RestClient.ListBySubscriptionNextPage(nextLink, top, cancellationToken); |
| 0 | 428 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 429 | | } |
| 0 | 430 | | catch (Exception e) |
| | 431 | | { |
| 0 | 432 | | scope.Failed(e); |
| 0 | 433 | | throw; |
| | 434 | | } |
| 0 | 435 | | } |
| 0 | 436 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 437 | | } |
| | 438 | |
|
| | 439 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 440 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 441 | | public virtual AsyncPageable<DeletedVault> ListDeletedAsync(CancellationToken cancellationToken = default) |
| | 442 | | { |
| | 443 | | async Task<Page<DeletedVault>> FirstPageFunc(int? pageSizeHint) |
| | 444 | | { |
| 2 | 445 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted"); |
| 2 | 446 | | scope.Start(); |
| | 447 | | try |
| | 448 | | { |
| 2 | 449 | | var response = await RestClient.ListDeletedAsync(cancellationToken).ConfigureAwait(false); |
| 2 | 450 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 451 | | } |
| 0 | 452 | | catch (Exception e) |
| | 453 | | { |
| 0 | 454 | | scope.Failed(e); |
| 0 | 455 | | throw; |
| | 456 | | } |
| 2 | 457 | | } |
| | 458 | | async Task<Page<DeletedVault>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 459 | | { |
| 0 | 460 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted"); |
| 0 | 461 | | scope.Start(); |
| | 462 | | try |
| | 463 | | { |
| 0 | 464 | | var response = await RestClient.ListDeletedNextPageAsync(nextLink, cancellationToken).ConfigureAwait |
| 0 | 465 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 466 | | } |
| 0 | 467 | | catch (Exception e) |
| | 468 | | { |
| 0 | 469 | | scope.Failed(e); |
| 0 | 470 | | throw; |
| | 471 | | } |
| 0 | 472 | | } |
| 2 | 473 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 474 | | } |
| | 475 | |
|
| | 476 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 477 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 478 | | public virtual Pageable<DeletedVault> ListDeleted(CancellationToken cancellationToken = default) |
| | 479 | | { |
| | 480 | | Page<DeletedVault> FirstPageFunc(int? pageSizeHint) |
| | 481 | | { |
| 2 | 482 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted"); |
| 2 | 483 | | scope.Start(); |
| | 484 | | try |
| | 485 | | { |
| 2 | 486 | | var response = RestClient.ListDeleted(cancellationToken); |
| 2 | 487 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 488 | | } |
| 0 | 489 | | catch (Exception e) |
| | 490 | | { |
| 0 | 491 | | scope.Failed(e); |
| 0 | 492 | | throw; |
| | 493 | | } |
| 2 | 494 | | } |
| | 495 | | Page<DeletedVault> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 496 | | { |
| 0 | 497 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.ListDeleted"); |
| 0 | 498 | | scope.Start(); |
| | 499 | | try |
| | 500 | | { |
| 0 | 501 | | var response = RestClient.ListDeletedNextPage(nextLink, cancellationToken); |
| 0 | 502 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 503 | | } |
| 0 | 504 | | catch (Exception e) |
| | 505 | | { |
| 0 | 506 | | scope.Failed(e); |
| 0 | 507 | | throw; |
| | 508 | | } |
| 0 | 509 | | } |
| 2 | 510 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 511 | | } |
| | 512 | |
|
| | 513 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 514 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 515 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 516 | | public virtual AsyncPageable<Resource> ListAsync(int? top = null, CancellationToken cancellationToken = default) |
| | 517 | | { |
| | 518 | | async Task<Page<Resource>> FirstPageFunc(int? pageSizeHint) |
| | 519 | | { |
| 0 | 520 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List"); |
| 0 | 521 | | scope.Start(); |
| | 522 | | try |
| | 523 | | { |
| 0 | 524 | | var response = await RestClient.ListAsync(top, cancellationToken).ConfigureAwait(false); |
| 0 | 525 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 526 | | } |
| 0 | 527 | | catch (Exception e) |
| | 528 | | { |
| 0 | 529 | | scope.Failed(e); |
| 0 | 530 | | throw; |
| | 531 | | } |
| 0 | 532 | | } |
| | 533 | | async Task<Page<Resource>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 534 | | { |
| 0 | 535 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List"); |
| 0 | 536 | | scope.Start(); |
| | 537 | | try |
| | 538 | | { |
| 0 | 539 | | var response = await RestClient.ListNextPageAsync(nextLink, top, cancellationToken).ConfigureAwait(f |
| 0 | 540 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 541 | | } |
| 0 | 542 | | catch (Exception e) |
| | 543 | | { |
| 0 | 544 | | scope.Failed(e); |
| 0 | 545 | | throw; |
| | 546 | | } |
| 0 | 547 | | } |
| 2 | 548 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 549 | | } |
| | 550 | |
|
| | 551 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 552 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 553 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 554 | | public virtual Pageable<Resource> List(int? top = null, CancellationToken cancellationToken = default) |
| | 555 | | { |
| | 556 | | Page<Resource> FirstPageFunc(int? pageSizeHint) |
| | 557 | | { |
| 0 | 558 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List"); |
| 0 | 559 | | scope.Start(); |
| | 560 | | try |
| | 561 | | { |
| 0 | 562 | | var response = RestClient.List(top, cancellationToken); |
| 0 | 563 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 564 | | } |
| 0 | 565 | | catch (Exception e) |
| | 566 | | { |
| 0 | 567 | | scope.Failed(e); |
| 0 | 568 | | throw; |
| | 569 | | } |
| 0 | 570 | | } |
| | 571 | | Page<Resource> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 572 | | { |
| 0 | 573 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.List"); |
| 0 | 574 | | scope.Start(); |
| | 575 | | try |
| | 576 | | { |
| 0 | 577 | | var response = RestClient.ListNextPage(nextLink, top, cancellationToken); |
| 0 | 578 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 579 | | } |
| 0 | 580 | | catch (Exception e) |
| | 581 | | { |
| 0 | 582 | | scope.Failed(e); |
| 0 | 583 | | throw; |
| | 584 | | } |
| 0 | 585 | | } |
| 2 | 586 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 587 | | } |
| | 588 | |
|
| | 589 | | /// <summary> Create or update a key vault in the specified subscription. </summary> |
| | 590 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 591 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 592 | | /// <param name="parameters"> Parameters to create or update the vault. </param> |
| | 593 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 594 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 595 | | public virtual async Task<VaultsCreateOrUpdateOperation> StartCreateOrUpdateAsync(string resourceGroupName, stri |
| | 596 | | { |
| 26 | 597 | | if (resourceGroupName == null) |
| | 598 | | { |
| 0 | 599 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 600 | | } |
| 26 | 601 | | if (vaultName == null) |
| | 602 | | { |
| 0 | 603 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 604 | | } |
| 26 | 605 | | if (parameters == null) |
| | 606 | | { |
| 0 | 607 | | throw new ArgumentNullException(nameof(parameters)); |
| | 608 | | } |
| | 609 | |
|
| 26 | 610 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartCreateOrUpdate"); |
| 26 | 611 | | scope.Start(); |
| | 612 | | try |
| | 613 | | { |
| 26 | 614 | | var originalResponse = await RestClient.CreateOrUpdateAsync(resourceGroupName, vaultName, parameters, ca |
| 26 | 615 | | return new VaultsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateR |
| | 616 | | } |
| 0 | 617 | | catch (Exception e) |
| | 618 | | { |
| 0 | 619 | | scope.Failed(e); |
| 0 | 620 | | throw; |
| | 621 | | } |
| 26 | 622 | | } |
| | 623 | |
|
| | 624 | | /// <summary> Create or update a key vault in the specified subscription. </summary> |
| | 625 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 626 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 627 | | /// <param name="parameters"> Parameters to create or update the vault. </param> |
| | 628 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 629 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 630 | | public virtual VaultsCreateOrUpdateOperation StartCreateOrUpdate(string resourceGroupName, string vaultName, Vau |
| | 631 | | { |
| 26 | 632 | | if (resourceGroupName == null) |
| | 633 | | { |
| 0 | 634 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 635 | | } |
| 26 | 636 | | if (vaultName == null) |
| | 637 | | { |
| 0 | 638 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 639 | | } |
| 26 | 640 | | if (parameters == null) |
| | 641 | | { |
| 0 | 642 | | throw new ArgumentNullException(nameof(parameters)); |
| | 643 | | } |
| | 644 | |
|
| 26 | 645 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartCreateOrUpdate"); |
| 26 | 646 | | scope.Start(); |
| | 647 | | try |
| | 648 | | { |
| 26 | 649 | | var originalResponse = RestClient.CreateOrUpdate(resourceGroupName, vaultName, parameters, cancellationT |
| 26 | 650 | | return new VaultsCreateOrUpdateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateOrUpdateR |
| | 651 | | } |
| 0 | 652 | | catch (Exception e) |
| | 653 | | { |
| 0 | 654 | | scope.Failed(e); |
| 0 | 655 | | throw; |
| | 656 | | } |
| 26 | 657 | | } |
| | 658 | |
|
| | 659 | | /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary> |
| | 660 | | /// <param name="vaultName"> The name of the soft-deleted vault. </param> |
| | 661 | | /// <param name="location"> The location of the soft-deleted vault. </param> |
| | 662 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 663 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 664 | | public virtual async Task<VaultsPurgeDeletedOperation> StartPurgeDeletedAsync(string vaultName, string location, |
| | 665 | | { |
| 6 | 666 | | if (vaultName == null) |
| | 667 | | { |
| 0 | 668 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 669 | | } |
| 6 | 670 | | if (location == null) |
| | 671 | | { |
| 0 | 672 | | throw new ArgumentNullException(nameof(location)); |
| | 673 | | } |
| | 674 | |
|
| 6 | 675 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartPurgeDeleted"); |
| 6 | 676 | | scope.Start(); |
| | 677 | | try |
| | 678 | | { |
| 6 | 679 | | var originalResponse = await RestClient.PurgeDeletedAsync(vaultName, location, cancellationToken).Config |
| 6 | 680 | | return new VaultsPurgeDeletedOperation(_clientDiagnostics, _pipeline, RestClient.CreatePurgeDeletedReque |
| | 681 | | } |
| 0 | 682 | | catch (Exception e) |
| | 683 | | { |
| 0 | 684 | | scope.Failed(e); |
| 0 | 685 | | throw; |
| | 686 | | } |
| 6 | 687 | | } |
| | 688 | |
|
| | 689 | | /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary> |
| | 690 | | /// <param name="vaultName"> The name of the soft-deleted vault. </param> |
| | 691 | | /// <param name="location"> The location of the soft-deleted vault. </param> |
| | 692 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 693 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 694 | | public virtual VaultsPurgeDeletedOperation StartPurgeDeleted(string vaultName, string location, CancellationToke |
| | 695 | | { |
| 6 | 696 | | if (vaultName == null) |
| | 697 | | { |
| 0 | 698 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 699 | | } |
| 6 | 700 | | if (location == null) |
| | 701 | | { |
| 0 | 702 | | throw new ArgumentNullException(nameof(location)); |
| | 703 | | } |
| | 704 | |
|
| 6 | 705 | | using var scope = _clientDiagnostics.CreateScope("VaultsOperations.StartPurgeDeleted"); |
| 6 | 706 | | scope.Start(); |
| | 707 | | try |
| | 708 | | { |
| 6 | 709 | | var originalResponse = RestClient.PurgeDeleted(vaultName, location, cancellationToken); |
| 6 | 710 | | return new VaultsPurgeDeletedOperation(_clientDiagnostics, _pipeline, RestClient.CreatePurgeDeletedReque |
| | 711 | | } |
| 0 | 712 | | catch (Exception e) |
| | 713 | | { |
| 0 | 714 | | scope.Failed(e); |
| 0 | 715 | | throw; |
| | 716 | | } |
| 6 | 717 | | } |
| | 718 | | } |
| | 719 | | } |