| | 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.Storage.Models; |
| | 16 | |
|
| | 17 | | namespace Azure.ResourceManager.Storage |
| | 18 | | { |
| | 19 | | internal partial class EncryptionScopesRestOperations |
| | 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 EncryptionScopesRestOperations. </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"> The ID of the target subscription. </param> |
| | 31 | | /// <param name="endpoint"> server parameter. </param> |
| | 32 | | /// <param name="apiVersion"> Api Version. </param> |
| | 33 | | /// <exception cref="ArgumentNullException"> This occurs when one of the required arguments is null. </exception |
| 240 | 34 | | public EncryptionScopesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscri |
| | 35 | | { |
| 240 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 240 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 240 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 240 | 46 | | this.subscriptionId = subscriptionId; |
| 240 | 47 | | this.endpoint = endpoint; |
| 240 | 48 | | this.apiVersion = apiVersion; |
| 240 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 240 | 50 | | _pipeline = pipeline; |
| 240 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreatePutRequest(string resourceGroupName, string accountName, string encryptionScopeName, |
| | 54 | | { |
| 12 | 55 | | var message = _pipeline.CreateMessage(); |
| 12 | 56 | | var request = message.Request; |
| 12 | 57 | | request.Method = RequestMethod.Put; |
| 12 | 58 | | var uri = new RawRequestUriBuilder(); |
| 12 | 59 | | uri.Reset(endpoint); |
| 12 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 12 | 61 | | uri.AppendPath(subscriptionId, true); |
| 12 | 62 | | uri.AppendPath("/resourceGroups/", false); |
| 12 | 63 | | uri.AppendPath(resourceGroupName, true); |
| 12 | 64 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 12 | 65 | | uri.AppendPath(accountName, true); |
| 12 | 66 | | uri.AppendPath("/encryptionScopes/", false); |
| 12 | 67 | | uri.AppendPath(encryptionScopeName, true); |
| 12 | 68 | | uri.AppendQuery("api-version", apiVersion, true); |
| 12 | 69 | | request.Uri = uri; |
| 12 | 70 | | request.Headers.Add("Content-Type", "application/json"); |
| 12 | 71 | | var content = new Utf8JsonRequestContent(); |
| 12 | 72 | | content.JsonWriter.WriteObjectValue(encryptionScope); |
| 12 | 73 | | request.Content = content; |
| 12 | 74 | | return message; |
| | 75 | | } |
| | 76 | |
|
| | 77 | | /// <summary> Synchronously creates or updates an encryption scope under the specified storage account. If an en |
| | 78 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 79 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 80 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 81 | | /// <param name="encryptionScope"> Encryption scope properties to be used for the create or update. </param> |
| | 82 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 83 | | public async Task<Response<EncryptionScope>> PutAsync(string resourceGroupName, string accountName, string encry |
| | 84 | | { |
| 6 | 85 | | if (resourceGroupName == null) |
| | 86 | | { |
| 0 | 87 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 88 | | } |
| 6 | 89 | | if (accountName == null) |
| | 90 | | { |
| 0 | 91 | | throw new ArgumentNullException(nameof(accountName)); |
| | 92 | | } |
| 6 | 93 | | if (encryptionScopeName == null) |
| | 94 | | { |
| 0 | 95 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 96 | | } |
| 6 | 97 | | if (encryptionScope == null) |
| | 98 | | { |
| 0 | 99 | | throw new ArgumentNullException(nameof(encryptionScope)); |
| | 100 | | } |
| | 101 | |
|
| 6 | 102 | | using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope); |
| 6 | 103 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 6 | 104 | | switch (message.Response.Status) |
| | 105 | | { |
| | 106 | | case 200: |
| | 107 | | case 201: |
| | 108 | | { |
| 6 | 109 | | EncryptionScope value = default; |
| 6 | 110 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 6 | 111 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 112 | | { |
| 0 | 113 | | value = null; |
| | 114 | | } |
| | 115 | | else |
| | 116 | | { |
| 6 | 117 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 118 | | } |
| 6 | 119 | | return Response.FromValue(value, message.Response); |
| | 120 | | } |
| | 121 | | default: |
| 0 | 122 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 123 | | } |
| 6 | 124 | | } |
| | 125 | |
|
| | 126 | | /// <summary> Synchronously creates or updates an encryption scope under the specified storage account. If an en |
| | 127 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 128 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 129 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 130 | | /// <param name="encryptionScope"> Encryption scope properties to be used for the create or update. </param> |
| | 131 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 132 | | public Response<EncryptionScope> Put(string resourceGroupName, string accountName, string encryptionScopeName, E |
| | 133 | | { |
| 6 | 134 | | if (resourceGroupName == null) |
| | 135 | | { |
| 0 | 136 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 137 | | } |
| 6 | 138 | | if (accountName == null) |
| | 139 | | { |
| 0 | 140 | | throw new ArgumentNullException(nameof(accountName)); |
| | 141 | | } |
| 6 | 142 | | if (encryptionScopeName == null) |
| | 143 | | { |
| 0 | 144 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 145 | | } |
| 6 | 146 | | if (encryptionScope == null) |
| | 147 | | { |
| 0 | 148 | | throw new ArgumentNullException(nameof(encryptionScope)); |
| | 149 | | } |
| | 150 | |
|
| 6 | 151 | | using var message = CreatePutRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope); |
| 6 | 152 | | _pipeline.Send(message, cancellationToken); |
| 6 | 153 | | switch (message.Response.Status) |
| | 154 | | { |
| | 155 | | case 200: |
| | 156 | | case 201: |
| | 157 | | { |
| 6 | 158 | | EncryptionScope value = default; |
| 6 | 159 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 6 | 160 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 161 | | { |
| 0 | 162 | | value = null; |
| | 163 | | } |
| | 164 | | else |
| | 165 | | { |
| 6 | 166 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 167 | | } |
| 6 | 168 | | return Response.FromValue(value, message.Response); |
| | 169 | | } |
| | 170 | | default: |
| 0 | 171 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 172 | | } |
| 6 | 173 | | } |
| | 174 | |
|
| | 175 | | internal HttpMessage CreatePatchRequest(string resourceGroupName, string accountName, string encryptionScopeName |
| | 176 | | { |
| 4 | 177 | | var message = _pipeline.CreateMessage(); |
| 4 | 178 | | var request = message.Request; |
| 4 | 179 | | request.Method = RequestMethod.Patch; |
| 4 | 180 | | var uri = new RawRequestUriBuilder(); |
| 4 | 181 | | uri.Reset(endpoint); |
| 4 | 182 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 183 | | uri.AppendPath(subscriptionId, true); |
| 4 | 184 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 185 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 186 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 4 | 187 | | uri.AppendPath(accountName, true); |
| 4 | 188 | | uri.AppendPath("/encryptionScopes/", false); |
| 4 | 189 | | uri.AppendPath(encryptionScopeName, true); |
| 4 | 190 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 191 | | request.Uri = uri; |
| 4 | 192 | | request.Headers.Add("Content-Type", "application/json"); |
| 4 | 193 | | var content = new Utf8JsonRequestContent(); |
| 4 | 194 | | content.JsonWriter.WriteObjectValue(encryptionScope); |
| 4 | 195 | | request.Content = content; |
| 4 | 196 | | return message; |
| | 197 | | } |
| | 198 | |
|
| | 199 | | /// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified |
| | 200 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 201 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 202 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 203 | | /// <param name="encryptionScope"> Encryption scope properties to be used for the update. </param> |
| | 204 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 205 | | public async Task<Response<EncryptionScope>> PatchAsync(string resourceGroupName, string accountName, string enc |
| | 206 | | { |
| 2 | 207 | | if (resourceGroupName == null) |
| | 208 | | { |
| 0 | 209 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 210 | | } |
| 2 | 211 | | if (accountName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(accountName)); |
| | 214 | | } |
| 2 | 215 | | if (encryptionScopeName == null) |
| | 216 | | { |
| 0 | 217 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 218 | | } |
| 2 | 219 | | if (encryptionScope == null) |
| | 220 | | { |
| 0 | 221 | | throw new ArgumentNullException(nameof(encryptionScope)); |
| | 222 | | } |
| | 223 | |
|
| 2 | 224 | | using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope) |
| 2 | 225 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 226 | | switch (message.Response.Status) |
| | 227 | | { |
| | 228 | | case 200: |
| | 229 | | { |
| 2 | 230 | | EncryptionScope value = default; |
| 2 | 231 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 232 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 233 | | { |
| 0 | 234 | | value = null; |
| | 235 | | } |
| | 236 | | else |
| | 237 | | { |
| 2 | 238 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 239 | | } |
| 2 | 240 | | return Response.FromValue(value, message.Response); |
| | 241 | | } |
| | 242 | | default: |
| 0 | 243 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 244 | | } |
| 2 | 245 | | } |
| | 246 | |
|
| | 247 | | /// <summary> Update encryption scope properties as specified in the request body. Update fails if the specified |
| | 248 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 249 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 250 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 251 | | /// <param name="encryptionScope"> Encryption scope properties to be used for the update. </param> |
| | 252 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 253 | | public Response<EncryptionScope> Patch(string resourceGroupName, string accountName, string encryptionScopeName, |
| | 254 | | { |
| 2 | 255 | | if (resourceGroupName == null) |
| | 256 | | { |
| 0 | 257 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 258 | | } |
| 2 | 259 | | if (accountName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(accountName)); |
| | 262 | | } |
| 2 | 263 | | if (encryptionScopeName == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 266 | | } |
| 2 | 267 | | if (encryptionScope == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(encryptionScope)); |
| | 270 | | } |
| | 271 | |
|
| 2 | 272 | | using var message = CreatePatchRequest(resourceGroupName, accountName, encryptionScopeName, encryptionScope) |
| 2 | 273 | | _pipeline.Send(message, cancellationToken); |
| 2 | 274 | | switch (message.Response.Status) |
| | 275 | | { |
| | 276 | | case 200: |
| | 277 | | { |
| 2 | 278 | | EncryptionScope value = default; |
| 2 | 279 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 280 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 281 | | { |
| 0 | 282 | | value = null; |
| | 283 | | } |
| | 284 | | else |
| | 285 | | { |
| 2 | 286 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 287 | | } |
| 2 | 288 | | return Response.FromValue(value, message.Response); |
| | 289 | | } |
| | 290 | | default: |
| 0 | 291 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 292 | | } |
| 2 | 293 | | } |
| | 294 | |
|
| | 295 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string encryptionScopeName) |
| | 296 | | { |
| 4 | 297 | | var message = _pipeline.CreateMessage(); |
| 4 | 298 | | var request = message.Request; |
| 4 | 299 | | request.Method = RequestMethod.Get; |
| 4 | 300 | | var uri = new RawRequestUriBuilder(); |
| 4 | 301 | | uri.Reset(endpoint); |
| 4 | 302 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 303 | | uri.AppendPath(subscriptionId, true); |
| 4 | 304 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 305 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 306 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 4 | 307 | | uri.AppendPath(accountName, true); |
| 4 | 308 | | uri.AppendPath("/encryptionScopes/", false); |
| 4 | 309 | | uri.AppendPath(encryptionScopeName, true); |
| 4 | 310 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 311 | | request.Uri = uri; |
| 4 | 312 | | return message; |
| | 313 | | } |
| | 314 | |
|
| | 315 | | /// <summary> Returns the properties for the specified encryption scope. </summary> |
| | 316 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 317 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 318 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 319 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 320 | | public async Task<Response<EncryptionScope>> GetAsync(string resourceGroupName, string accountName, string encry |
| | 321 | | { |
| 2 | 322 | | if (resourceGroupName == null) |
| | 323 | | { |
| 0 | 324 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 325 | | } |
| 2 | 326 | | if (accountName == null) |
| | 327 | | { |
| 0 | 328 | | throw new ArgumentNullException(nameof(accountName)); |
| | 329 | | } |
| 2 | 330 | | if (encryptionScopeName == null) |
| | 331 | | { |
| 0 | 332 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 333 | | } |
| | 334 | |
|
| 2 | 335 | | using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName); |
| 2 | 336 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 337 | | switch (message.Response.Status) |
| | 338 | | { |
| | 339 | | case 200: |
| | 340 | | { |
| 2 | 341 | | EncryptionScope value = default; |
| 2 | 342 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 343 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 344 | | { |
| 0 | 345 | | value = null; |
| | 346 | | } |
| | 347 | | else |
| | 348 | | { |
| 2 | 349 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 350 | | } |
| 2 | 351 | | return Response.FromValue(value, message.Response); |
| | 352 | | } |
| | 353 | | default: |
| 0 | 354 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 355 | | } |
| 2 | 356 | | } |
| | 357 | |
|
| | 358 | | /// <summary> Returns the properties for the specified encryption scope. </summary> |
| | 359 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 360 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 361 | | /// <param name="encryptionScopeName"> The name of the encryption scope within the specified storage account. En |
| | 362 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 363 | | public Response<EncryptionScope> Get(string resourceGroupName, string accountName, string encryptionScopeName, C |
| | 364 | | { |
| 2 | 365 | | if (resourceGroupName == null) |
| | 366 | | { |
| 0 | 367 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 368 | | } |
| 2 | 369 | | if (accountName == null) |
| | 370 | | { |
| 0 | 371 | | throw new ArgumentNullException(nameof(accountName)); |
| | 372 | | } |
| 2 | 373 | | if (encryptionScopeName == null) |
| | 374 | | { |
| 0 | 375 | | throw new ArgumentNullException(nameof(encryptionScopeName)); |
| | 376 | | } |
| | 377 | |
|
| 2 | 378 | | using var message = CreateGetRequest(resourceGroupName, accountName, encryptionScopeName); |
| 2 | 379 | | _pipeline.Send(message, cancellationToken); |
| 2 | 380 | | switch (message.Response.Status) |
| | 381 | | { |
| | 382 | | case 200: |
| | 383 | | { |
| 2 | 384 | | EncryptionScope value = default; |
| 2 | 385 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 386 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 387 | | { |
| 0 | 388 | | value = null; |
| | 389 | | } |
| | 390 | | else |
| | 391 | | { |
| 2 | 392 | | value = EncryptionScope.DeserializeEncryptionScope(document.RootElement); |
| | 393 | | } |
| 2 | 394 | | return Response.FromValue(value, message.Response); |
| | 395 | | } |
| | 396 | | default: |
| 0 | 397 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 398 | | } |
| 2 | 399 | | } |
| | 400 | |
|
| | 401 | | internal HttpMessage CreateListRequest(string resourceGroupName, string accountName) |
| | 402 | | { |
| 4 | 403 | | var message = _pipeline.CreateMessage(); |
| 4 | 404 | | var request = message.Request; |
| 4 | 405 | | request.Method = RequestMethod.Get; |
| 4 | 406 | | var uri = new RawRequestUriBuilder(); |
| 4 | 407 | | uri.Reset(endpoint); |
| 4 | 408 | | uri.AppendPath("/subscriptions/", false); |
| 4 | 409 | | uri.AppendPath(subscriptionId, true); |
| 4 | 410 | | uri.AppendPath("/resourceGroups/", false); |
| 4 | 411 | | uri.AppendPath(resourceGroupName, true); |
| 4 | 412 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 4 | 413 | | uri.AppendPath(accountName, true); |
| 4 | 414 | | uri.AppendPath("/encryptionScopes", false); |
| 4 | 415 | | uri.AppendQuery("api-version", apiVersion, true); |
| 4 | 416 | | request.Uri = uri; |
| 4 | 417 | | return message; |
| | 418 | | } |
| | 419 | |
|
| | 420 | | /// <summary> Lists all the encryption scopes available under the specified storage account. </summary> |
| | 421 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 422 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 423 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 424 | | public async Task<Response<EncryptionScopeListResult>> ListAsync(string resourceGroupName, string accountName, C |
| | 425 | | { |
| 2 | 426 | | if (resourceGroupName == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 429 | | } |
| 2 | 430 | | if (accountName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(accountName)); |
| | 433 | | } |
| | 434 | |
|
| 2 | 435 | | using var message = CreateListRequest(resourceGroupName, accountName); |
| 2 | 436 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 2 | 437 | | switch (message.Response.Status) |
| | 438 | | { |
| | 439 | | case 200: |
| | 440 | | { |
| 2 | 441 | | EncryptionScopeListResult value = default; |
| 2 | 442 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 2 | 443 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 444 | | { |
| 0 | 445 | | value = null; |
| | 446 | | } |
| | 447 | | else |
| | 448 | | { |
| 2 | 449 | | value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement) |
| | 450 | | } |
| 2 | 451 | | return Response.FromValue(value, message.Response); |
| | 452 | | } |
| | 453 | | default: |
| 0 | 454 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 455 | | } |
| 2 | 456 | | } |
| | 457 | |
|
| | 458 | | /// <summary> Lists all the encryption scopes available under the specified storage account. </summary> |
| | 459 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 460 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 461 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 462 | | public Response<EncryptionScopeListResult> List(string resourceGroupName, string accountName, CancellationToken |
| | 463 | | { |
| 2 | 464 | | if (resourceGroupName == null) |
| | 465 | | { |
| 0 | 466 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 467 | | } |
| 2 | 468 | | if (accountName == null) |
| | 469 | | { |
| 0 | 470 | | throw new ArgumentNullException(nameof(accountName)); |
| | 471 | | } |
| | 472 | |
|
| 2 | 473 | | using var message = CreateListRequest(resourceGroupName, accountName); |
| 2 | 474 | | _pipeline.Send(message, cancellationToken); |
| 2 | 475 | | switch (message.Response.Status) |
| | 476 | | { |
| | 477 | | case 200: |
| | 478 | | { |
| 2 | 479 | | EncryptionScopeListResult value = default; |
| 2 | 480 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 2 | 481 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 482 | | { |
| 0 | 483 | | value = null; |
| | 484 | | } |
| | 485 | | else |
| | 486 | | { |
| 2 | 487 | | value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement) |
| | 488 | | } |
| 2 | 489 | | return Response.FromValue(value, message.Response); |
| | 490 | | } |
| | 491 | | default: |
| 0 | 492 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 493 | | } |
| 2 | 494 | | } |
| | 495 | |
|
| | 496 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string accountName) |
| | 497 | | { |
| 0 | 498 | | var message = _pipeline.CreateMessage(); |
| 0 | 499 | | var request = message.Request; |
| 0 | 500 | | request.Method = RequestMethod.Get; |
| 0 | 501 | | var uri = new RawRequestUriBuilder(); |
| 0 | 502 | | uri.Reset(endpoint); |
| 0 | 503 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 504 | | request.Uri = uri; |
| 0 | 505 | | return message; |
| | 506 | | } |
| | 507 | |
|
| | 508 | | /// <summary> Lists all the encryption scopes available under the specified storage account. </summary> |
| | 509 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 510 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 511 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 512 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 513 | | public async Task<Response<EncryptionScopeListResult>> ListNextPageAsync(string nextLink, string resourceGroupNa |
| | 514 | | { |
| 0 | 515 | | if (nextLink == null) |
| | 516 | | { |
| 0 | 517 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 518 | | } |
| 0 | 519 | | if (resourceGroupName == null) |
| | 520 | | { |
| 0 | 521 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 522 | | } |
| 0 | 523 | | if (accountName == null) |
| | 524 | | { |
| 0 | 525 | | throw new ArgumentNullException(nameof(accountName)); |
| | 526 | | } |
| | 527 | |
|
| 0 | 528 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName); |
| 0 | 529 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 530 | | switch (message.Response.Status) |
| | 531 | | { |
| | 532 | | case 200: |
| | 533 | | { |
| 0 | 534 | | EncryptionScopeListResult value = default; |
| 0 | 535 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 536 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 537 | | { |
| 0 | 538 | | value = null; |
| | 539 | | } |
| | 540 | | else |
| | 541 | | { |
| 0 | 542 | | value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement) |
| | 543 | | } |
| 0 | 544 | | return Response.FromValue(value, message.Response); |
| | 545 | | } |
| | 546 | | default: |
| 0 | 547 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 548 | | } |
| 0 | 549 | | } |
| | 550 | |
|
| | 551 | | /// <summary> Lists all the encryption scopes available under the specified storage account. </summary> |
| | 552 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 553 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 554 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 555 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 556 | | public Response<EncryptionScopeListResult> ListNextPage(string nextLink, string resourceGroupName, string accoun |
| | 557 | | { |
| 0 | 558 | | if (nextLink == null) |
| | 559 | | { |
| 0 | 560 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 561 | | } |
| 0 | 562 | | if (resourceGroupName == null) |
| | 563 | | { |
| 0 | 564 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 565 | | } |
| 0 | 566 | | if (accountName == null) |
| | 567 | | { |
| 0 | 568 | | throw new ArgumentNullException(nameof(accountName)); |
| | 569 | | } |
| | 570 | |
|
| 0 | 571 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName); |
| 0 | 572 | | _pipeline.Send(message, cancellationToken); |
| 0 | 573 | | switch (message.Response.Status) |
| | 574 | | { |
| | 575 | | case 200: |
| | 576 | | { |
| 0 | 577 | | EncryptionScopeListResult value = default; |
| 0 | 578 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 579 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 580 | | { |
| 0 | 581 | | value = null; |
| | 582 | | } |
| | 583 | | else |
| | 584 | | { |
| 0 | 585 | | value = EncryptionScopeListResult.DeserializeEncryptionScopeListResult(document.RootElement) |
| | 586 | | } |
| 0 | 587 | | return Response.FromValue(value, message.Response); |
| | 588 | | } |
| | 589 | | default: |
| 0 | 590 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 591 | | } |
| 0 | 592 | | } |
| | 593 | | } |
| | 594 | | } |