| | 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.Text.Json; |
| | 10 | | using System.Threading; |
| | 11 | | using System.Threading.Tasks; |
| | 12 | | using Azure; |
| | 13 | | using Azure.Core; |
| | 14 | | using Azure.Core.Pipeline; |
| | 15 | | using Azure.ResourceManager.KeyVault.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.KeyVault |
| | 18 | | { |
| | 19 | | internal partial class VaultsRestOperations |
| | 20 | | { |
| | 21 | | private string subscriptionId; |
| | 22 | | private Uri endpoint; |
| | 23 | | private string apiVersion; |
| | 24 | | private ClientDiagnostics _clientDiagnostics; |
| | 25 | | private HttpPipeline _pipeline; |
| | 26 | |
|
| | 27 | | /// <summary> Initializes a new instance of VaultsRestOperations. </summary> |
| | 28 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 29 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 30 | | /// <param name="subscriptionId"> Subscription credentials which uniquely identify Microsoft Azure subscription. |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| | 33 | | /// <exception cref="ArgumentNullException"> <paramref name="subscriptionId"/> or <paramref name="apiVersion"/> |
| 24 | 34 | | public VaultsRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, U |
| | 35 | | { |
| 24 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 24 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 24 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 24 | 46 | | this.subscriptionId = subscriptionId; |
| 24 | 47 | | this.endpoint = endpoint; |
| 24 | 48 | | this.apiVersion = apiVersion; |
| 24 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 24 | 50 | | _pipeline = pipeline; |
| 24 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreateCreateOrUpdateRequest(string resourceGroupName, string vaultName, VaultCreateOrUpdate |
| | 54 | | { |
| 104 | 55 | | var message = _pipeline.CreateMessage(); |
| 104 | 56 | | var request = message.Request; |
| 104 | 57 | | request.Method = RequestMethod.Put; |
| 104 | 58 | | var uri = new RawRequestUriBuilder(); |
| 104 | 59 | | uri.Reset(endpoint); |
| 104 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 104 | 61 | | uri.AppendPath(subscriptionId, true); |
| 104 | 62 | | uri.AppendPath("/resourceGroups/", false); |
| 104 | 63 | | uri.AppendPath(resourceGroupName, true); |
| 104 | 64 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); |
| 104 | 65 | | uri.AppendPath(vaultName, true); |
| 104 | 66 | | uri.AppendQuery("api-version", apiVersion, true); |
| 104 | 67 | | request.Uri = uri; |
| 104 | 68 | | request.Headers.Add("Content-Type", "application/json"); |
| 104 | 69 | | var content = new Utf8JsonRequestContent(); |
| 104 | 70 | | content.JsonWriter.WriteObjectValue(parameters); |
| 104 | 71 | | request.Content = content; |
| 104 | 72 | | return message; |
| | 73 | | } |
| | 74 | |
|
| | 75 | | /// <summary> Create or update a key vault in the specified subscription. </summary> |
| | 76 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 77 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 78 | | /// <param name="parameters"> Parameters to create or update the vault. </param> |
| | 79 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 80 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 81 | | public async Task<Response> CreateOrUpdateAsync(string resourceGroupName, string vaultName, VaultCreateOrUpdateP |
| | 82 | | { |
| 26 | 83 | | if (resourceGroupName == null) |
| | 84 | | { |
| 0 | 85 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 86 | | } |
| 26 | 87 | | if (vaultName == null) |
| | 88 | | { |
| 0 | 89 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 90 | | } |
| 26 | 91 | | if (parameters == null) |
| | 92 | | { |
| 0 | 93 | | throw new ArgumentNullException(nameof(parameters)); |
| | 94 | | } |
| | 95 | |
|
| 26 | 96 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, vaultName, parameters); |
| 26 | 97 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 26 | 98 | | switch (message.Response.Status) |
| | 99 | | { |
| | 100 | | case 200: |
| | 101 | | case 201: |
| 26 | 102 | | return message.Response; |
| | 103 | | default: |
| 0 | 104 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 105 | | } |
| 26 | 106 | | } |
| | 107 | |
|
| | 108 | | /// <summary> Create or update a key vault in the specified subscription. </summary> |
| | 109 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 110 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 111 | | /// <param name="parameters"> Parameters to create or update the vault. </param> |
| | 112 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 113 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 114 | | public Response CreateOrUpdate(string resourceGroupName, string vaultName, VaultCreateOrUpdateParameters paramet |
| | 115 | | { |
| 26 | 116 | | if (resourceGroupName == null) |
| | 117 | | { |
| 0 | 118 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 119 | | } |
| 26 | 120 | | if (vaultName == null) |
| | 121 | | { |
| 0 | 122 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 123 | | } |
| 26 | 124 | | if (parameters == null) |
| | 125 | | { |
| 0 | 126 | | throw new ArgumentNullException(nameof(parameters)); |
| | 127 | | } |
| | 128 | |
|
| 26 | 129 | | using var message = CreateCreateOrUpdateRequest(resourceGroupName, vaultName, parameters); |
| 26 | 130 | | _pipeline.Send(message, cancellationToken); |
| 26 | 131 | | switch (message.Response.Status) |
| | 132 | | { |
| | 133 | | case 200: |
| | 134 | | case 201: |
| 26 | 135 | | return message.Response; |
| | 136 | | default: |
| 0 | 137 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 138 | | } |
| 26 | 139 | | } |
| | 140 | |
|
| | 141 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string vaultName, VaultPatchParameters parame |
| | 142 | | { |
| 0 | 143 | | var message = _pipeline.CreateMessage(); |
| 0 | 144 | | var request = message.Request; |
| 0 | 145 | | request.Method = RequestMethod.Patch; |
| 0 | 146 | | var uri = new RawRequestUriBuilder(); |
| 0 | 147 | | uri.Reset(endpoint); |
| 0 | 148 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 149 | | uri.AppendPath(subscriptionId, true); |
| 0 | 150 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 151 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 152 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); |
| 0 | 153 | | uri.AppendPath(vaultName, true); |
| 0 | 154 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 155 | | request.Uri = uri; |
| 0 | 156 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 157 | | var content = new Utf8JsonRequestContent(); |
| 0 | 158 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 159 | | request.Content = content; |
| 0 | 160 | | return message; |
| | 161 | | } |
| | 162 | |
|
| | 163 | | /// <summary> Update a key vault in the specified subscription. </summary> |
| | 164 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 165 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 166 | | /// <param name="parameters"> Parameters to patch the vault. </param> |
| | 167 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 168 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 169 | | public async Task<Response<Vault>> UpdateAsync(string resourceGroupName, string vaultName, VaultPatchParameters |
| | 170 | | { |
| 0 | 171 | | if (resourceGroupName == null) |
| | 172 | | { |
| 0 | 173 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 174 | | } |
| 0 | 175 | | if (vaultName == null) |
| | 176 | | { |
| 0 | 177 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 178 | | } |
| 0 | 179 | | if (parameters == null) |
| | 180 | | { |
| 0 | 181 | | throw new ArgumentNullException(nameof(parameters)); |
| | 182 | | } |
| | 183 | |
|
| 0 | 184 | | using var message = CreateUpdateRequest(resourceGroupName, vaultName, parameters); |
| 0 | 185 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 186 | | switch (message.Response.Status) |
| | 187 | | { |
| | 188 | | case 200: |
| | 189 | | case 201: |
| | 190 | | { |
| | 191 | | Vault value = default; |
| 0 | 192 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 193 | | value = Vault.DeserializeVault(document.RootElement); |
| 0 | 194 | | return Response.FromValue(value, message.Response); |
| | 195 | | } |
| | 196 | | default: |
| 0 | 197 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 198 | | } |
| 0 | 199 | | } |
| | 200 | |
|
| | 201 | | /// <summary> Update a key vault in the specified subscription. </summary> |
| | 202 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the server belongs. </param> |
| | 203 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 204 | | /// <param name="parameters"> Parameters to patch the vault. </param> |
| | 205 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 206 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 207 | | public Response<Vault> Update(string resourceGroupName, string vaultName, VaultPatchParameters parameters, Cance |
| | 208 | | { |
| 0 | 209 | | if (resourceGroupName == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 212 | | } |
| 0 | 213 | | if (vaultName == null) |
| | 214 | | { |
| 0 | 215 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 216 | | } |
| 0 | 217 | | if (parameters == null) |
| | 218 | | { |
| 0 | 219 | | throw new ArgumentNullException(nameof(parameters)); |
| | 220 | | } |
| | 221 | |
|
| 0 | 222 | | using var message = CreateUpdateRequest(resourceGroupName, vaultName, parameters); |
| 0 | 223 | | _pipeline.Send(message, cancellationToken); |
| 0 | 224 | | switch (message.Response.Status) |
| | 225 | | { |
| | 226 | | case 200: |
| | 227 | | case 201: |
| | 228 | | { |
| | 229 | | Vault value = default; |
| 0 | 230 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 231 | | value = Vault.DeserializeVault(document.RootElement); |
| 0 | 232 | | return Response.FromValue(value, message.Response); |
| | 233 | | } |
| | 234 | | default: |
| 0 | 235 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 236 | | } |
| 0 | 237 | | } |
| | 238 | |
|
| | 239 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string vaultName) |
| | 240 | | { |
| 48 | 241 | | var message = _pipeline.CreateMessage(); |
| 48 | 242 | | var request = message.Request; |
| 48 | 243 | | request.Method = RequestMethod.Delete; |
| 48 | 244 | | var uri = new RawRequestUriBuilder(); |
| 48 | 245 | | uri.Reset(endpoint); |
| 48 | 246 | | uri.AppendPath("/subscriptions/", false); |
| 48 | 247 | | uri.AppendPath(subscriptionId, true); |
| 48 | 248 | | uri.AppendPath("/resourceGroups/", false); |
| 48 | 249 | | uri.AppendPath(resourceGroupName, true); |
| 48 | 250 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); |
| 48 | 251 | | uri.AppendPath(vaultName, true); |
| 48 | 252 | | uri.AppendQuery("api-version", apiVersion, true); |
| 48 | 253 | | request.Uri = uri; |
| 48 | 254 | | return message; |
| | 255 | | } |
| | 256 | |
|
| | 257 | | /// <summary> Deletes the specified Azure key vault. </summary> |
| | 258 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 259 | | /// <param name="vaultName"> The name of the vault to delete. </param> |
| | 260 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 261 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/ |
| | 262 | | public async Task<Response> DeleteAsync(string resourceGroupName, string vaultName, CancellationToken cancellati |
| | 263 | | { |
| 24 | 264 | | if (resourceGroupName == null) |
| | 265 | | { |
| 0 | 266 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 267 | | } |
| 24 | 268 | | if (vaultName == null) |
| | 269 | | { |
| 0 | 270 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 271 | | } |
| | 272 | |
|
| 24 | 273 | | using var message = CreateDeleteRequest(resourceGroupName, vaultName); |
| 24 | 274 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 24 | 275 | | switch (message.Response.Status) |
| | 276 | | { |
| | 277 | | case 200: |
| 24 | 278 | | return message.Response; |
| | 279 | | default: |
| 0 | 280 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 281 | | } |
| 24 | 282 | | } |
| | 283 | |
|
| | 284 | | /// <summary> Deletes the specified Azure key vault. </summary> |
| | 285 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 286 | | /// <param name="vaultName"> The name of the vault to delete. </param> |
| | 287 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 288 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/ |
| | 289 | | public Response Delete(string resourceGroupName, string vaultName, CancellationToken cancellationToken = default |
| | 290 | | { |
| 24 | 291 | | if (resourceGroupName == null) |
| | 292 | | { |
| 0 | 293 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 294 | | } |
| 24 | 295 | | if (vaultName == null) |
| | 296 | | { |
| 0 | 297 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 298 | | } |
| | 299 | |
|
| 24 | 300 | | using var message = CreateDeleteRequest(resourceGroupName, vaultName); |
| 24 | 301 | | _pipeline.Send(message, cancellationToken); |
| 24 | 302 | | switch (message.Response.Status) |
| | 303 | | { |
| | 304 | | case 200: |
| 24 | 305 | | return message.Response; |
| | 306 | | default: |
| 0 | 307 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 308 | | } |
| 24 | 309 | | } |
| | 310 | |
|
| | 311 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string vaultName) |
| | 312 | | { |
| 28 | 313 | | var message = _pipeline.CreateMessage(); |
| 28 | 314 | | var request = message.Request; |
| 28 | 315 | | request.Method = RequestMethod.Get; |
| 28 | 316 | | var uri = new RawRequestUriBuilder(); |
| 28 | 317 | | uri.Reset(endpoint); |
| 28 | 318 | | uri.AppendPath("/subscriptions/", false); |
| 28 | 319 | | uri.AppendPath(subscriptionId, true); |
| 28 | 320 | | uri.AppendPath("/resourceGroups/", false); |
| 28 | 321 | | uri.AppendPath(resourceGroupName, true); |
| 28 | 322 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); |
| 28 | 323 | | uri.AppendPath(vaultName, true); |
| 28 | 324 | | uri.AppendQuery("api-version", apiVersion, true); |
| 28 | 325 | | request.Uri = uri; |
| 28 | 326 | | return message; |
| | 327 | | } |
| | 328 | |
|
| | 329 | | /// <summary> Gets the specified Azure key vault. </summary> |
| | 330 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 331 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 332 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 333 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/ |
| | 334 | | public async Task<Response<Vault>> GetAsync(string resourceGroupName, string vaultName, CancellationToken cancel |
| | 335 | | { |
| 14 | 336 | | if (resourceGroupName == null) |
| | 337 | | { |
| 0 | 338 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 339 | | } |
| 14 | 340 | | if (vaultName == null) |
| | 341 | | { |
| 0 | 342 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 343 | | } |
| | 344 | |
|
| 14 | 345 | | using var message = CreateGetRequest(resourceGroupName, vaultName); |
| 14 | 346 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 14 | 347 | | switch (message.Response.Status) |
| | 348 | | { |
| | 349 | | case 200: |
| | 350 | | { |
| | 351 | | Vault value = default; |
| 8 | 352 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 8 | 353 | | value = Vault.DeserializeVault(document.RootElement); |
| 8 | 354 | | return Response.FromValue(value, message.Response); |
| | 355 | | } |
| | 356 | | default: |
| 6 | 357 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 358 | | } |
| 8 | 359 | | } |
| | 360 | |
|
| | 361 | | /// <summary> Gets the specified Azure key vault. </summary> |
| | 362 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 363 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 364 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 365 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> or <paramref name="vaultName"/ |
| | 366 | | public Response<Vault> Get(string resourceGroupName, string vaultName, CancellationToken cancellationToken = def |
| | 367 | | { |
| 14 | 368 | | if (resourceGroupName == null) |
| | 369 | | { |
| 0 | 370 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 371 | | } |
| 14 | 372 | | if (vaultName == null) |
| | 373 | | { |
| 0 | 374 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 375 | | } |
| | 376 | |
|
| 14 | 377 | | using var message = CreateGetRequest(resourceGroupName, vaultName); |
| 14 | 378 | | _pipeline.Send(message, cancellationToken); |
| 14 | 379 | | switch (message.Response.Status) |
| | 380 | | { |
| | 381 | | case 200: |
| | 382 | | { |
| | 383 | | Vault value = default; |
| 8 | 384 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 8 | 385 | | value = Vault.DeserializeVault(document.RootElement); |
| 8 | 386 | | return Response.FromValue(value, message.Response); |
| | 387 | | } |
| | 388 | | default: |
| 6 | 389 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 390 | | } |
| 8 | 391 | | } |
| | 392 | |
|
| | 393 | | internal HttpMessage CreateUpdateAccessPolicyRequest(string resourceGroupName, string vaultName, AccessPolicyUpd |
| | 394 | | { |
| 0 | 395 | | var message = _pipeline.CreateMessage(); |
| 0 | 396 | | var request = message.Request; |
| 0 | 397 | | request.Method = RequestMethod.Put; |
| 0 | 398 | | var uri = new RawRequestUriBuilder(); |
| 0 | 399 | | uri.Reset(endpoint); |
| 0 | 400 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 401 | | uri.AppendPath(subscriptionId, true); |
| 0 | 402 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 403 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 404 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults/", false); |
| 0 | 405 | | uri.AppendPath(vaultName, true); |
| 0 | 406 | | uri.AppendPath("/accessPolicies/", false); |
| 0 | 407 | | uri.AppendPath(operationKind.ToSerialString(), true); |
| 0 | 408 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 409 | | request.Uri = uri; |
| 0 | 410 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 411 | | var content = new Utf8JsonRequestContent(); |
| 0 | 412 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 413 | | request.Content = content; |
| 0 | 414 | | return message; |
| | 415 | | } |
| | 416 | |
|
| | 417 | | /// <summary> Update access policies in a key vault in the specified subscription. </summary> |
| | 418 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 419 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 420 | | /// <param name="operationKind"> Name of the operation. </param> |
| | 421 | | /// <param name="parameters"> Access policy to merge into the vault. </param> |
| | 422 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 423 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 424 | | public async Task<Response<VaultAccessPolicyParameters>> UpdateAccessPolicyAsync(string resourceGroupName, strin |
| | 425 | | { |
| 0 | 426 | | if (resourceGroupName == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 429 | | } |
| 0 | 430 | | if (vaultName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 433 | | } |
| 0 | 434 | | if (parameters == null) |
| | 435 | | { |
| 0 | 436 | | throw new ArgumentNullException(nameof(parameters)); |
| | 437 | | } |
| | 438 | |
|
| 0 | 439 | | using var message = CreateUpdateAccessPolicyRequest(resourceGroupName, vaultName, operationKind, parameters) |
| 0 | 440 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 441 | | switch (message.Response.Status) |
| | 442 | | { |
| | 443 | | case 200: |
| | 444 | | case 201: |
| | 445 | | { |
| | 446 | | VaultAccessPolicyParameters value = default; |
| 0 | 447 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 448 | | value = VaultAccessPolicyParameters.DeserializeVaultAccessPolicyParameters(document.RootElement) |
| 0 | 449 | | return Response.FromValue(value, message.Response); |
| | 450 | | } |
| | 451 | | default: |
| 0 | 452 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 453 | | } |
| 0 | 454 | | } |
| | 455 | |
|
| | 456 | | /// <summary> Update access policies in a key vault in the specified subscription. </summary> |
| | 457 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 458 | | /// <param name="vaultName"> Name of the vault. </param> |
| | 459 | | /// <param name="operationKind"> Name of the operation. </param> |
| | 460 | | /// <param name="parameters"> Access policy to merge into the vault. </param> |
| | 461 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 462 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/>, <paramref name="vaultName"/>, |
| | 463 | | public Response<VaultAccessPolicyParameters> UpdateAccessPolicy(string resourceGroupName, string vaultName, Acce |
| | 464 | | { |
| 0 | 465 | | if (resourceGroupName == null) |
| | 466 | | { |
| 0 | 467 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 468 | | } |
| 0 | 469 | | if (vaultName == null) |
| | 470 | | { |
| 0 | 471 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 472 | | } |
| 0 | 473 | | if (parameters == null) |
| | 474 | | { |
| 0 | 475 | | throw new ArgumentNullException(nameof(parameters)); |
| | 476 | | } |
| | 477 | |
|
| 0 | 478 | | using var message = CreateUpdateAccessPolicyRequest(resourceGroupName, vaultName, operationKind, parameters) |
| 0 | 479 | | _pipeline.Send(message, cancellationToken); |
| 0 | 480 | | switch (message.Response.Status) |
| | 481 | | { |
| | 482 | | case 200: |
| | 483 | | case 201: |
| | 484 | | { |
| | 485 | | VaultAccessPolicyParameters value = default; |
| 0 | 486 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 487 | | value = VaultAccessPolicyParameters.DeserializeVaultAccessPolicyParameters(document.RootElement) |
| 0 | 488 | | return Response.FromValue(value, message.Response); |
| | 489 | | } |
| | 490 | | default: |
| 0 | 491 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 492 | | } |
| 0 | 493 | | } |
| | 494 | |
|
| | 495 | | internal HttpMessage CreateListByResourceGroupRequest(string resourceGroupName, int? top) |
| | 496 | | { |
| 4 | 497 | | var message = _pipeline.CreateMessage(); |
| 4 | 498 | | var request = message.Request; |
| 4 | 499 | | request.Method = RequestMethod.Get; |
| 4 | 500 | | var uri = new RawRequestUriBuilder(); |
| 4 | 501 | | uri.Reset(endpoint); |
| 4 | 502 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 503 | | uri.AppendPath(subscriptionId, true); |
| 4 | 504 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 505 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 506 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); |
| 4 | 507 | | if (top != null) |
| | 508 | | { |
| 4 | 509 | | uri.AppendQuery("$top", top.Value, true); |
| | 510 | | } |
| 4 | 511 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 512 | | request.Uri = uri; |
| 4 | 513 | | return message; |
| | 514 | | } |
| | 515 | |
|
| | 516 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 517 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 518 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 519 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 520 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception> |
| | 521 | | public async Task<Response<VaultListResult>> ListByResourceGroupAsync(string resourceGroupName, int? top = null, |
| | 522 | | { |
| 2 | 523 | | if (resourceGroupName == null) |
| | 524 | | { |
| 0 | 525 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 526 | | } |
| | 527 | |
|
| 2 | 528 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, top); |
| 2 | 529 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 530 | | switch (message.Response.Status) |
| | 531 | | { |
| | 532 | | case 200: |
| | 533 | | { |
| | 534 | | VaultListResult value = default; |
| 2 | 535 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 536 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 2 | 537 | | return Response.FromValue(value, message.Response); |
| | 538 | | } |
| | 539 | | default: |
| 0 | 540 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 541 | | } |
| 2 | 542 | | } |
| | 543 | |
|
| | 544 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 545 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 546 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 547 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 548 | | /// <exception cref="ArgumentNullException"> <paramref name="resourceGroupName"/> is null. </exception> |
| | 549 | | public Response<VaultListResult> ListByResourceGroup(string resourceGroupName, int? top = null, CancellationToke |
| | 550 | | { |
| 2 | 551 | | if (resourceGroupName == null) |
| | 552 | | { |
| 0 | 553 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 554 | | } |
| | 555 | |
|
| 2 | 556 | | using var message = CreateListByResourceGroupRequest(resourceGroupName, top); |
| 2 | 557 | | _pipeline.Send(message, cancellationToken); |
| 2 | 558 | | switch (message.Response.Status) |
| | 559 | | { |
| | 560 | | case 200: |
| | 561 | | { |
| | 562 | | VaultListResult value = default; |
| 2 | 563 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 564 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 2 | 565 | | return Response.FromValue(value, message.Response); |
| | 566 | | } |
| | 567 | | default: |
| 0 | 568 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 569 | | } |
| 2 | 570 | | } |
| | 571 | |
|
| | 572 | | internal HttpMessage CreateListBySubscriptionRequest(int? top) |
| | 573 | | { |
| 0 | 574 | | var message = _pipeline.CreateMessage(); |
| 0 | 575 | | var request = message.Request; |
| 0 | 576 | | request.Method = RequestMethod.Get; |
| 0 | 577 | | var uri = new RawRequestUriBuilder(); |
| 0 | 578 | | uri.Reset(endpoint); |
| 0 | 579 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 580 | | uri.AppendPath(subscriptionId, true); |
| 0 | 581 | | uri.AppendPath("/providers/Microsoft.KeyVault/vaults", false); |
| 0 | 582 | | if (top != null) |
| | 583 | | { |
| 0 | 584 | | uri.AppendQuery("$top", top.Value, true); |
| | 585 | | } |
| 0 | 586 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 587 | | request.Uri = uri; |
| 0 | 588 | | return message; |
| | 589 | | } |
| | 590 | |
|
| | 591 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 592 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 593 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 594 | | public async Task<Response<VaultListResult>> ListBySubscriptionAsync(int? top = null, CancellationToken cancella |
| | 595 | | { |
| 0 | 596 | | using var message = CreateListBySubscriptionRequest(top); |
| 0 | 597 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 598 | | switch (message.Response.Status) |
| | 599 | | { |
| | 600 | | case 200: |
| | 601 | | { |
| | 602 | | VaultListResult value = default; |
| 0 | 603 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 604 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 0 | 605 | | return Response.FromValue(value, message.Response); |
| | 606 | | } |
| | 607 | | default: |
| 0 | 608 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 609 | | } |
| 0 | 610 | | } |
| | 611 | |
|
| | 612 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 613 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 614 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 615 | | public Response<VaultListResult> ListBySubscription(int? top = null, CancellationToken cancellationToken = defau |
| | 616 | | { |
| 0 | 617 | | using var message = CreateListBySubscriptionRequest(top); |
| 0 | 618 | | _pipeline.Send(message, cancellationToken); |
| 0 | 619 | | switch (message.Response.Status) |
| | 620 | | { |
| | 621 | | case 200: |
| | 622 | | { |
| | 623 | | VaultListResult value = default; |
| 0 | 624 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 625 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 0 | 626 | | return Response.FromValue(value, message.Response); |
| | 627 | | } |
| | 628 | | default: |
| 0 | 629 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 630 | | } |
| 0 | 631 | | } |
| | 632 | |
|
| | 633 | | internal HttpMessage CreateListDeletedRequest() |
| | 634 | | { |
| 4 | 635 | | var message = _pipeline.CreateMessage(); |
| 4 | 636 | | var request = message.Request; |
| 4 | 637 | | request.Method = RequestMethod.Get; |
| 4 | 638 | | var uri = new RawRequestUriBuilder(); |
| 4 | 639 | | uri.Reset(endpoint); |
| 4 | 640 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 641 | | uri.AppendPath(subscriptionId, true); |
| 4 | 642 | | uri.AppendPath("/providers/Microsoft.KeyVault/deletedVaults", false); |
| 4 | 643 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 644 | | request.Uri = uri; |
| 4 | 645 | | return message; |
| | 646 | | } |
| | 647 | |
|
| | 648 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 649 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 650 | | public async Task<Response<DeletedVaultListResult>> ListDeletedAsync(CancellationToken cancellationToken = defau |
| | 651 | | { |
| 2 | 652 | | using var message = CreateListDeletedRequest(); |
| 2 | 653 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 654 | | switch (message.Response.Status) |
| | 655 | | { |
| | 656 | | case 200: |
| | 657 | | { |
| | 658 | | DeletedVaultListResult value = default; |
| 2 | 659 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 660 | | value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); |
| 2 | 661 | | return Response.FromValue(value, message.Response); |
| | 662 | | } |
| | 663 | | default: |
| 0 | 664 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 665 | | } |
| 2 | 666 | | } |
| | 667 | |
|
| | 668 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 669 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 670 | | public Response<DeletedVaultListResult> ListDeleted(CancellationToken cancellationToken = default) |
| | 671 | | { |
| 2 | 672 | | using var message = CreateListDeletedRequest(); |
| 2 | 673 | | _pipeline.Send(message, cancellationToken); |
| 2 | 674 | | switch (message.Response.Status) |
| | 675 | | { |
| | 676 | | case 200: |
| | 677 | | { |
| | 678 | | DeletedVaultListResult value = default; |
| 2 | 679 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 680 | | value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); |
| 2 | 681 | | return Response.FromValue(value, message.Response); |
| | 682 | | } |
| | 683 | | default: |
| 0 | 684 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 685 | | } |
| 2 | 686 | | } |
| | 687 | |
|
| | 688 | | internal HttpMessage CreateGetDeletedRequest(string vaultName, string location) |
| | 689 | | { |
| 24 | 690 | | var message = _pipeline.CreateMessage(); |
| 24 | 691 | | var request = message.Request; |
| 24 | 692 | | request.Method = RequestMethod.Get; |
| 24 | 693 | | var uri = new RawRequestUriBuilder(); |
| 24 | 694 | | uri.Reset(endpoint); |
| 24 | 695 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 696 | | uri.AppendPath(subscriptionId, true); |
| 24 | 697 | | uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); |
| 24 | 698 | | uri.AppendPath(location, true); |
| 24 | 699 | | uri.AppendPath("/deletedVaults/", false); |
| 24 | 700 | | uri.AppendPath(vaultName, true); |
| 24 | 701 | | uri.AppendQuery("api-version", apiVersion, true); |
| 24 | 702 | | request.Uri = uri; |
| 24 | 703 | | return message; |
| | 704 | | } |
| | 705 | |
|
| | 706 | | /// <summary> Gets the deleted Azure key vault. </summary> |
| | 707 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 708 | | /// <param name="location"> The location of the deleted vault. </param> |
| | 709 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 710 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 711 | | public async Task<Response<DeletedVault>> GetDeletedAsync(string vaultName, string location, CancellationToken c |
| | 712 | | { |
| 12 | 713 | | if (vaultName == null) |
| | 714 | | { |
| 0 | 715 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 716 | | } |
| 12 | 717 | | if (location == null) |
| | 718 | | { |
| 0 | 719 | | throw new ArgumentNullException(nameof(location)); |
| | 720 | | } |
| | 721 | |
|
| 12 | 722 | | using var message = CreateGetDeletedRequest(vaultName, location); |
| 12 | 723 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 12 | 724 | | switch (message.Response.Status) |
| | 725 | | { |
| | 726 | | case 200: |
| | 727 | | { |
| | 728 | | DeletedVault value = default; |
| 6 | 729 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 730 | | value = DeletedVault.DeserializeDeletedVault(document.RootElement); |
| 6 | 731 | | return Response.FromValue(value, message.Response); |
| | 732 | | } |
| | 733 | | default: |
| 6 | 734 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 735 | | } |
| 6 | 736 | | } |
| | 737 | |
|
| | 738 | | /// <summary> Gets the deleted Azure key vault. </summary> |
| | 739 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 740 | | /// <param name="location"> The location of the deleted vault. </param> |
| | 741 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 742 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 743 | | public Response<DeletedVault> GetDeleted(string vaultName, string location, CancellationToken cancellationToken |
| | 744 | | { |
| 12 | 745 | | if (vaultName == null) |
| | 746 | | { |
| 0 | 747 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 748 | | } |
| 12 | 749 | | if (location == null) |
| | 750 | | { |
| 0 | 751 | | throw new ArgumentNullException(nameof(location)); |
| | 752 | | } |
| | 753 | |
|
| 12 | 754 | | using var message = CreateGetDeletedRequest(vaultName, location); |
| 12 | 755 | | _pipeline.Send(message, cancellationToken); |
| 12 | 756 | | switch (message.Response.Status) |
| | 757 | | { |
| | 758 | | case 200: |
| | 759 | | { |
| | 760 | | DeletedVault value = default; |
| 6 | 761 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 762 | | value = DeletedVault.DeserializeDeletedVault(document.RootElement); |
| 6 | 763 | | return Response.FromValue(value, message.Response); |
| | 764 | | } |
| | 765 | | default: |
| 6 | 766 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 767 | | } |
| 6 | 768 | | } |
| | 769 | |
|
| | 770 | | internal HttpMessage CreatePurgeDeletedRequest(string vaultName, string location) |
| | 771 | | { |
| 24 | 772 | | var message = _pipeline.CreateMessage(); |
| 24 | 773 | | var request = message.Request; |
| 24 | 774 | | request.Method = RequestMethod.Post; |
| 24 | 775 | | var uri = new RawRequestUriBuilder(); |
| 24 | 776 | | uri.Reset(endpoint); |
| 24 | 777 | | uri.AppendPath("/subscriptions/", false); |
| 24 | 778 | | uri.AppendPath(subscriptionId, true); |
| 24 | 779 | | uri.AppendPath("/providers/Microsoft.KeyVault/locations/", false); |
| 24 | 780 | | uri.AppendPath(location, true); |
| 24 | 781 | | uri.AppendPath("/deletedVaults/", false); |
| 24 | 782 | | uri.AppendPath(vaultName, true); |
| 24 | 783 | | uri.AppendPath("/purge", false); |
| 24 | 784 | | uri.AppendQuery("api-version", apiVersion, true); |
| 24 | 785 | | request.Uri = uri; |
| 24 | 786 | | return message; |
| | 787 | | } |
| | 788 | |
|
| | 789 | | /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary> |
| | 790 | | /// <param name="vaultName"> The name of the soft-deleted vault. </param> |
| | 791 | | /// <param name="location"> The location of the soft-deleted vault. </param> |
| | 792 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 793 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 794 | | public async Task<Response> PurgeDeletedAsync(string vaultName, string location, CancellationToken cancellationT |
| | 795 | | { |
| 6 | 796 | | if (vaultName == null) |
| | 797 | | { |
| 0 | 798 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 799 | | } |
| 6 | 800 | | if (location == null) |
| | 801 | | { |
| 0 | 802 | | throw new ArgumentNullException(nameof(location)); |
| | 803 | | } |
| | 804 | |
|
| 6 | 805 | | using var message = CreatePurgeDeletedRequest(vaultName, location); |
| 6 | 806 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 807 | | switch (message.Response.Status) |
| | 808 | | { |
| | 809 | | case 200: |
| | 810 | | case 202: |
| 6 | 811 | | return message.Response; |
| | 812 | | default: |
| 0 | 813 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 814 | | } |
| 6 | 815 | | } |
| | 816 | |
|
| | 817 | | /// <summary> Permanently deletes the specified vault. aka Purges the deleted Azure key vault. </summary> |
| | 818 | | /// <param name="vaultName"> The name of the soft-deleted vault. </param> |
| | 819 | | /// <param name="location"> The location of the soft-deleted vault. </param> |
| | 820 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 821 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> or <paramref name="location"/> is null |
| | 822 | | public Response PurgeDeleted(string vaultName, string location, CancellationToken cancellationToken = default) |
| | 823 | | { |
| 6 | 824 | | if (vaultName == null) |
| | 825 | | { |
| 0 | 826 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 827 | | } |
| 6 | 828 | | if (location == null) |
| | 829 | | { |
| 0 | 830 | | throw new ArgumentNullException(nameof(location)); |
| | 831 | | } |
| | 832 | |
|
| 6 | 833 | | using var message = CreatePurgeDeletedRequest(vaultName, location); |
| 6 | 834 | | _pipeline.Send(message, cancellationToken); |
| 6 | 835 | | switch (message.Response.Status) |
| | 836 | | { |
| | 837 | | case 200: |
| | 838 | | case 202: |
| 6 | 839 | | return message.Response; |
| | 840 | | default: |
| 0 | 841 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 842 | | } |
| 6 | 843 | | } |
| | 844 | |
|
| | 845 | | internal HttpMessage CreateListRequest(int? top) |
| | 846 | | { |
| 0 | 847 | | var message = _pipeline.CreateMessage(); |
| 0 | 848 | | var request = message.Request; |
| 0 | 849 | | request.Method = RequestMethod.Get; |
| 0 | 850 | | var uri = new RawRequestUriBuilder(); |
| 0 | 851 | | uri.Reset(endpoint); |
| 0 | 852 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 853 | | uri.AppendPath(subscriptionId, true); |
| 0 | 854 | | uri.AppendPath("/resources", false); |
| 0 | 855 | | uri.AppendQuery("$filter", "resourceType eq 'Microsoft.KeyVault/vaults'", true); |
| 0 | 856 | | if (top != null) |
| | 857 | | { |
| 0 | 858 | | uri.AppendQuery("$top", top.Value, true); |
| | 859 | | } |
| 0 | 860 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 861 | | request.Uri = uri; |
| 0 | 862 | | return message; |
| | 863 | | } |
| | 864 | |
|
| | 865 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 866 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 867 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 868 | | public async Task<Response<ResourceListResult>> ListAsync(int? top = null, CancellationToken cancellationToken = |
| | 869 | | { |
| 0 | 870 | | using var message = CreateListRequest(top); |
| 0 | 871 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 872 | | switch (message.Response.Status) |
| | 873 | | { |
| | 874 | | case 200: |
| | 875 | | { |
| | 876 | | ResourceListResult value = default; |
| 0 | 877 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 878 | | value = ResourceListResult.DeserializeResourceListResult(document.RootElement); |
| 0 | 879 | | return Response.FromValue(value, message.Response); |
| | 880 | | } |
| | 881 | | default: |
| 0 | 882 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 883 | | } |
| 0 | 884 | | } |
| | 885 | |
|
| | 886 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 887 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 888 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 889 | | public Response<ResourceListResult> List(int? top = null, CancellationToken cancellationToken = default) |
| | 890 | | { |
| 0 | 891 | | using var message = CreateListRequest(top); |
| 0 | 892 | | _pipeline.Send(message, cancellationToken); |
| 0 | 893 | | switch (message.Response.Status) |
| | 894 | | { |
| | 895 | | case 200: |
| | 896 | | { |
| | 897 | | ResourceListResult value = default; |
| 0 | 898 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 899 | | value = ResourceListResult.DeserializeResourceListResult(document.RootElement); |
| 0 | 900 | | return Response.FromValue(value, message.Response); |
| | 901 | | } |
| | 902 | | default: |
| 0 | 903 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 904 | | } |
| 0 | 905 | | } |
| | 906 | |
|
| | 907 | | internal HttpMessage CreateCheckNameAvailabilityRequest(VaultCheckNameAvailabilityParameters vaultName) |
| | 908 | | { |
| 0 | 909 | | var message = _pipeline.CreateMessage(); |
| 0 | 910 | | var request = message.Request; |
| 0 | 911 | | request.Method = RequestMethod.Post; |
| 0 | 912 | | var uri = new RawRequestUriBuilder(); |
| 0 | 913 | | uri.Reset(endpoint); |
| 0 | 914 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 915 | | uri.AppendPath(subscriptionId, true); |
| 0 | 916 | | uri.AppendPath("/providers/Microsoft.KeyVault/checkNameAvailability", false); |
| 0 | 917 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 918 | | request.Uri = uri; |
| 0 | 919 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 920 | | var content = new Utf8JsonRequestContent(); |
| 0 | 921 | | content.JsonWriter.WriteObjectValue(vaultName); |
| 0 | 922 | | request.Content = content; |
| 0 | 923 | | return message; |
| | 924 | | } |
| | 925 | |
|
| | 926 | | /// <summary> Checks that the vault name is valid and is not already in use. </summary> |
| | 927 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 928 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 929 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> is null. </exception> |
| | 930 | | public async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(VaultCheckNameAvailabilityPa |
| | 931 | | { |
| 0 | 932 | | if (vaultName == null) |
| | 933 | | { |
| 0 | 934 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 935 | | } |
| | 936 | |
|
| 0 | 937 | | using var message = CreateCheckNameAvailabilityRequest(vaultName); |
| 0 | 938 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 939 | | switch (message.Response.Status) |
| | 940 | | { |
| | 941 | | case 200: |
| | 942 | | { |
| | 943 | | CheckNameAvailabilityResult value = default; |
| 0 | 944 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 945 | | value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement) |
| 0 | 946 | | return Response.FromValue(value, message.Response); |
| | 947 | | } |
| | 948 | | default: |
| 0 | 949 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 950 | | } |
| 0 | 951 | | } |
| | 952 | |
|
| | 953 | | /// <summary> Checks that the vault name is valid and is not already in use. </summary> |
| | 954 | | /// <param name="vaultName"> The name of the vault. </param> |
| | 955 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 956 | | /// <exception cref="ArgumentNullException"> <paramref name="vaultName"/> is null. </exception> |
| | 957 | | public Response<CheckNameAvailabilityResult> CheckNameAvailability(VaultCheckNameAvailabilityParameters vaultNam |
| | 958 | | { |
| 0 | 959 | | if (vaultName == null) |
| | 960 | | { |
| 0 | 961 | | throw new ArgumentNullException(nameof(vaultName)); |
| | 962 | | } |
| | 963 | |
|
| 0 | 964 | | using var message = CreateCheckNameAvailabilityRequest(vaultName); |
| 0 | 965 | | _pipeline.Send(message, cancellationToken); |
| 0 | 966 | | switch (message.Response.Status) |
| | 967 | | { |
| | 968 | | case 200: |
| | 969 | | { |
| | 970 | | CheckNameAvailabilityResult value = default; |
| 0 | 971 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 972 | | value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement) |
| 0 | 973 | | return Response.FromValue(value, message.Response); |
| | 974 | | } |
| | 975 | | default: |
| 0 | 976 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 977 | | } |
| 0 | 978 | | } |
| | 979 | |
|
| | 980 | | internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string resourceGroupName, int? to |
| | 981 | | { |
| 4 | 982 | | var message = _pipeline.CreateMessage(); |
| 4 | 983 | | var request = message.Request; |
| 4 | 984 | | request.Method = RequestMethod.Get; |
| 4 | 985 | | var uri = new RawRequestUriBuilder(); |
| 4 | 986 | | uri.Reset(endpoint); |
| 4 | 987 | | uri.AppendRawNextLink(nextLink, false); |
| 4 | 988 | | request.Uri = uri; |
| 4 | 989 | | return message; |
| | 990 | | } |
| | 991 | |
|
| | 992 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 993 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 994 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 995 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 996 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 997 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="resourceGroupName"/> |
| | 998 | | public async Task<Response<VaultListResult>> ListByResourceGroupNextPageAsync(string nextLink, string resourceGr |
| | 999 | | { |
| 2 | 1000 | | if (nextLink == null) |
| | 1001 | | { |
| 0 | 1002 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1003 | | } |
| 2 | 1004 | | if (resourceGroupName == null) |
| | 1005 | | { |
| 0 | 1006 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1007 | | } |
| | 1008 | |
|
| 2 | 1009 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, top); |
| 2 | 1010 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 1011 | | switch (message.Response.Status) |
| | 1012 | | { |
| | 1013 | | case 200: |
| | 1014 | | { |
| | 1015 | | VaultListResult value = default; |
| 2 | 1016 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 1017 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 2 | 1018 | | return Response.FromValue(value, message.Response); |
| | 1019 | | } |
| | 1020 | | default: |
| 0 | 1021 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1022 | | } |
| 2 | 1023 | | } |
| | 1024 | |
|
| | 1025 | | /// <summary> The List operation gets information about the vaults associated with the subscription and within t |
| | 1026 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1027 | | /// <param name="resourceGroupName"> The name of the Resource Group to which the vault belongs. </param> |
| | 1028 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 1029 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1030 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> or <paramref name="resourceGroupName"/> |
| | 1031 | | public Response<VaultListResult> ListByResourceGroupNextPage(string nextLink, string resourceGroupName, int? top |
| | 1032 | | { |
| 2 | 1033 | | if (nextLink == null) |
| | 1034 | | { |
| 0 | 1035 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1036 | | } |
| 2 | 1037 | | if (resourceGroupName == null) |
| | 1038 | | { |
| 0 | 1039 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 1040 | | } |
| | 1041 | |
|
| 2 | 1042 | | using var message = CreateListByResourceGroupNextPageRequest(nextLink, resourceGroupName, top); |
| 2 | 1043 | | _pipeline.Send(message, cancellationToken); |
| 2 | 1044 | | switch (message.Response.Status) |
| | 1045 | | { |
| | 1046 | | case 200: |
| | 1047 | | { |
| | 1048 | | VaultListResult value = default; |
| 2 | 1049 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 1050 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 2 | 1051 | | return Response.FromValue(value, message.Response); |
| | 1052 | | } |
| | 1053 | | default: |
| 0 | 1054 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1055 | | } |
| 2 | 1056 | | } |
| | 1057 | |
|
| | 1058 | | internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, int? top) |
| | 1059 | | { |
| 0 | 1060 | | var message = _pipeline.CreateMessage(); |
| 0 | 1061 | | var request = message.Request; |
| 0 | 1062 | | request.Method = RequestMethod.Get; |
| 0 | 1063 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1064 | | uri.Reset(endpoint); |
| 0 | 1065 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1066 | | request.Uri = uri; |
| 0 | 1067 | | return message; |
| | 1068 | | } |
| | 1069 | |
|
| | 1070 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 1071 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1072 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 1073 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1074 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1075 | | public async Task<Response<VaultListResult>> ListBySubscriptionNextPageAsync(string nextLink, int? top = null, C |
| | 1076 | | { |
| 0 | 1077 | | if (nextLink == null) |
| | 1078 | | { |
| 0 | 1079 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1080 | | } |
| | 1081 | |
|
| 0 | 1082 | | using var message = CreateListBySubscriptionNextPageRequest(nextLink, top); |
| 0 | 1083 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1084 | | switch (message.Response.Status) |
| | 1085 | | { |
| | 1086 | | case 200: |
| | 1087 | | { |
| | 1088 | | VaultListResult value = default; |
| 0 | 1089 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1090 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 0 | 1091 | | return Response.FromValue(value, message.Response); |
| | 1092 | | } |
| | 1093 | | default: |
| 0 | 1094 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1095 | | } |
| 0 | 1096 | | } |
| | 1097 | |
|
| | 1098 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 1099 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1100 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 1101 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1102 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1103 | | public Response<VaultListResult> ListBySubscriptionNextPage(string nextLink, int? top = null, CancellationToken |
| | 1104 | | { |
| 0 | 1105 | | if (nextLink == null) |
| | 1106 | | { |
| 0 | 1107 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1108 | | } |
| | 1109 | |
|
| 0 | 1110 | | using var message = CreateListBySubscriptionNextPageRequest(nextLink, top); |
| 0 | 1111 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1112 | | switch (message.Response.Status) |
| | 1113 | | { |
| | 1114 | | case 200: |
| | 1115 | | { |
| | 1116 | | VaultListResult value = default; |
| 0 | 1117 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1118 | | value = VaultListResult.DeserializeVaultListResult(document.RootElement); |
| 0 | 1119 | | return Response.FromValue(value, message.Response); |
| | 1120 | | } |
| | 1121 | | default: |
| 0 | 1122 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1123 | | } |
| 0 | 1124 | | } |
| | 1125 | |
|
| | 1126 | | internal HttpMessage CreateListDeletedNextPageRequest(string nextLink) |
| | 1127 | | { |
| 0 | 1128 | | var message = _pipeline.CreateMessage(); |
| 0 | 1129 | | var request = message.Request; |
| 0 | 1130 | | request.Method = RequestMethod.Get; |
| 0 | 1131 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1132 | | uri.Reset(endpoint); |
| 0 | 1133 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1134 | | request.Uri = uri; |
| 0 | 1135 | | return message; |
| | 1136 | | } |
| | 1137 | |
|
| | 1138 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 1139 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1140 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1141 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1142 | | public async Task<Response<DeletedVaultListResult>> ListDeletedNextPageAsync(string nextLink, CancellationToken |
| | 1143 | | { |
| 0 | 1144 | | if (nextLink == null) |
| | 1145 | | { |
| 0 | 1146 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1147 | | } |
| | 1148 | |
|
| 0 | 1149 | | using var message = CreateListDeletedNextPageRequest(nextLink); |
| 0 | 1150 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1151 | | switch (message.Response.Status) |
| | 1152 | | { |
| | 1153 | | case 200: |
| | 1154 | | { |
| | 1155 | | DeletedVaultListResult value = default; |
| 0 | 1156 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1157 | | value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); |
| 0 | 1158 | | return Response.FromValue(value, message.Response); |
| | 1159 | | } |
| | 1160 | | default: |
| 0 | 1161 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1162 | | } |
| 0 | 1163 | | } |
| | 1164 | |
|
| | 1165 | | /// <summary> Gets information about the deleted vaults in a subscription. </summary> |
| | 1166 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1167 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1168 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1169 | | public Response<DeletedVaultListResult> ListDeletedNextPage(string nextLink, CancellationToken cancellationToken |
| | 1170 | | { |
| 0 | 1171 | | if (nextLink == null) |
| | 1172 | | { |
| 0 | 1173 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1174 | | } |
| | 1175 | |
|
| 0 | 1176 | | using var message = CreateListDeletedNextPageRequest(nextLink); |
| 0 | 1177 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1178 | | switch (message.Response.Status) |
| | 1179 | | { |
| | 1180 | | case 200: |
| | 1181 | | { |
| | 1182 | | DeletedVaultListResult value = default; |
| 0 | 1183 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1184 | | value = DeletedVaultListResult.DeserializeDeletedVaultListResult(document.RootElement); |
| 0 | 1185 | | return Response.FromValue(value, message.Response); |
| | 1186 | | } |
| | 1187 | | default: |
| 0 | 1188 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1189 | | } |
| 0 | 1190 | | } |
| | 1191 | |
|
| | 1192 | | internal HttpMessage CreateListNextPageRequest(string nextLink, int? top) |
| | 1193 | | { |
| 0 | 1194 | | var message = _pipeline.CreateMessage(); |
| 0 | 1195 | | var request = message.Request; |
| 0 | 1196 | | request.Method = RequestMethod.Get; |
| 0 | 1197 | | var uri = new RawRequestUriBuilder(); |
| 0 | 1198 | | uri.Reset(endpoint); |
| 0 | 1199 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 1200 | | request.Uri = uri; |
| 0 | 1201 | | return message; |
| | 1202 | | } |
| | 1203 | |
|
| | 1204 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 1205 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1206 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 1207 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1208 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1209 | | public async Task<Response<ResourceListResult>> ListNextPageAsync(string nextLink, int? top = null, Cancellation |
| | 1210 | | { |
| 0 | 1211 | | if (nextLink == null) |
| | 1212 | | { |
| 0 | 1213 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1214 | | } |
| | 1215 | |
|
| 0 | 1216 | | using var message = CreateListNextPageRequest(nextLink, top); |
| 0 | 1217 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 1218 | | switch (message.Response.Status) |
| | 1219 | | { |
| | 1220 | | case 200: |
| | 1221 | | { |
| | 1222 | | ResourceListResult value = default; |
| 0 | 1223 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 1224 | | value = ResourceListResult.DeserializeResourceListResult(document.RootElement); |
| 0 | 1225 | | return Response.FromValue(value, message.Response); |
| | 1226 | | } |
| | 1227 | | default: |
| 0 | 1228 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 1229 | | } |
| 0 | 1230 | | } |
| | 1231 | |
|
| | 1232 | | /// <summary> The List operation gets information about the vaults associated with the subscription. </summary> |
| | 1233 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 1234 | | /// <param name="top"> Maximum number of results to return. </param> |
| | 1235 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 1236 | | /// <exception cref="ArgumentNullException"> <paramref name="nextLink"/> is null. </exception> |
| | 1237 | | public Response<ResourceListResult> ListNextPage(string nextLink, int? top = null, CancellationToken cancellatio |
| | 1238 | | { |
| 0 | 1239 | | if (nextLink == null) |
| | 1240 | | { |
| 0 | 1241 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 1242 | | } |
| | 1243 | |
|
| 0 | 1244 | | using var message = CreateListNextPageRequest(nextLink, top); |
| 0 | 1245 | | _pipeline.Send(message, cancellationToken); |
| 0 | 1246 | | switch (message.Response.Status) |
| | 1247 | | { |
| | 1248 | | case 200: |
| | 1249 | | { |
| | 1250 | | ResourceListResult value = default; |
| 0 | 1251 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 1252 | | value = ResourceListResult.DeserializeResourceListResult(document.RootElement); |
| 0 | 1253 | | return Response.FromValue(value, message.Response); |
| | 1254 | | } |
| | 1255 | | default: |
| 0 | 1256 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 1257 | | } |
| 0 | 1258 | | } |
| | 1259 | | } |
| | 1260 | | } |