| | 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 QueueRestOperations |
| | 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 QueueRestOperations. </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 |
| 0 | 34 | | public QueueRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Ur |
| | 35 | | { |
| 0 | 36 | | if (subscriptionId == null) |
| | 37 | | { |
| 0 | 38 | | throw new ArgumentNullException(nameof(subscriptionId)); |
| | 39 | | } |
| 0 | 40 | | endpoint ??= new Uri("https://management.azure.com"); |
| 0 | 41 | | if (apiVersion == null) |
| | 42 | | { |
| 0 | 43 | | throw new ArgumentNullException(nameof(apiVersion)); |
| | 44 | | } |
| | 45 | |
|
| 0 | 46 | | this.subscriptionId = subscriptionId; |
| 0 | 47 | | this.endpoint = endpoint; |
| 0 | 48 | | this.apiVersion = apiVersion; |
| 0 | 49 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 50 | | _pipeline = pipeline; |
| 0 | 51 | | } |
| | 52 | |
|
| | 53 | | internal HttpMessage CreateCreateRequest(string resourceGroupName, string accountName, string queueName, Storage |
| | 54 | | { |
| 0 | 55 | | var message = _pipeline.CreateMessage(); |
| 0 | 56 | | var request = message.Request; |
| 0 | 57 | | request.Method = RequestMethod.Put; |
| 0 | 58 | | var uri = new RawRequestUriBuilder(); |
| 0 | 59 | | uri.Reset(endpoint); |
| 0 | 60 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 61 | | uri.AppendPath(subscriptionId, true); |
| 0 | 62 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 63 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 64 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 65 | | uri.AppendPath(accountName, true); |
| 0 | 66 | | uri.AppendPath("/queueServices/default/queues/", false); |
| 0 | 67 | | uri.AppendPath(queueName, true); |
| 0 | 68 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 69 | | request.Uri = uri; |
| 0 | 70 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 71 | | var content = new Utf8JsonRequestContent(); |
| 0 | 72 | | content.JsonWriter.WriteObjectValue(queue); |
| 0 | 73 | | request.Content = content; |
| 0 | 74 | | return message; |
| | 75 | | } |
| | 76 | |
|
| | 77 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 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="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 81 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 82 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 83 | | public async Task<Response<StorageQueue>> CreateAsync(string resourceGroupName, string accountName, string queue |
| | 84 | | { |
| 0 | 85 | | if (resourceGroupName == null) |
| | 86 | | { |
| 0 | 87 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 88 | | } |
| 0 | 89 | | if (accountName == null) |
| | 90 | | { |
| 0 | 91 | | throw new ArgumentNullException(nameof(accountName)); |
| | 92 | | } |
| 0 | 93 | | if (queueName == null) |
| | 94 | | { |
| 0 | 95 | | throw new ArgumentNullException(nameof(queueName)); |
| | 96 | | } |
| 0 | 97 | | if (queue == null) |
| | 98 | | { |
| 0 | 99 | | throw new ArgumentNullException(nameof(queue)); |
| | 100 | | } |
| | 101 | |
|
| 0 | 102 | | using var message = CreateCreateRequest(resourceGroupName, accountName, queueName, queue); |
| 0 | 103 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 104 | | switch (message.Response.Status) |
| | 105 | | { |
| | 106 | | case 200: |
| | 107 | | { |
| 0 | 108 | | StorageQueue value = default; |
| 0 | 109 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 110 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 111 | | { |
| 0 | 112 | | value = null; |
| | 113 | | } |
| | 114 | | else |
| | 115 | | { |
| 0 | 116 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 117 | | } |
| 0 | 118 | | return Response.FromValue(value, message.Response); |
| | 119 | | } |
| | 120 | | default: |
| 0 | 121 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 122 | | } |
| 0 | 123 | | } |
| | 124 | |
|
| | 125 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 126 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 127 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 128 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 129 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 130 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 131 | | public Response<StorageQueue> Create(string resourceGroupName, string accountName, string queueName, StorageQueu |
| | 132 | | { |
| 0 | 133 | | if (resourceGroupName == null) |
| | 134 | | { |
| 0 | 135 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 136 | | } |
| 0 | 137 | | if (accountName == null) |
| | 138 | | { |
| 0 | 139 | | throw new ArgumentNullException(nameof(accountName)); |
| | 140 | | } |
| 0 | 141 | | if (queueName == null) |
| | 142 | | { |
| 0 | 143 | | throw new ArgumentNullException(nameof(queueName)); |
| | 144 | | } |
| 0 | 145 | | if (queue == null) |
| | 146 | | { |
| 0 | 147 | | throw new ArgumentNullException(nameof(queue)); |
| | 148 | | } |
| | 149 | |
|
| 0 | 150 | | using var message = CreateCreateRequest(resourceGroupName, accountName, queueName, queue); |
| 0 | 151 | | _pipeline.Send(message, cancellationToken); |
| 0 | 152 | | switch (message.Response.Status) |
| | 153 | | { |
| | 154 | | case 200: |
| | 155 | | { |
| 0 | 156 | | StorageQueue value = default; |
| 0 | 157 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 158 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| 0 | 160 | | value = null; |
| | 161 | | } |
| | 162 | | else |
| | 163 | | { |
| 0 | 164 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 165 | | } |
| 0 | 166 | | return Response.FromValue(value, message.Response); |
| | 167 | | } |
| | 168 | | default: |
| 0 | 169 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 170 | | } |
| 0 | 171 | | } |
| | 172 | |
|
| | 173 | | internal HttpMessage CreateUpdateRequest(string resourceGroupName, string accountName, string queueName, Storage |
| | 174 | | { |
| 0 | 175 | | var message = _pipeline.CreateMessage(); |
| 0 | 176 | | var request = message.Request; |
| 0 | 177 | | request.Method = RequestMethod.Patch; |
| 0 | 178 | | var uri = new RawRequestUriBuilder(); |
| 0 | 179 | | uri.Reset(endpoint); |
| 0 | 180 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 181 | | uri.AppendPath(subscriptionId, true); |
| 0 | 182 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 183 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 184 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 185 | | uri.AppendPath(accountName, true); |
| 0 | 186 | | uri.AppendPath("/queueServices/default/queues/", false); |
| 0 | 187 | | uri.AppendPath(queueName, true); |
| 0 | 188 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 189 | | request.Uri = uri; |
| 0 | 190 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 191 | | var content = new Utf8JsonRequestContent(); |
| 0 | 192 | | content.JsonWriter.WriteObjectValue(queue); |
| 0 | 193 | | request.Content = content; |
| 0 | 194 | | return message; |
| | 195 | | } |
| | 196 | |
|
| | 197 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 198 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 199 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 200 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 201 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 202 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 203 | | public async Task<Response<StorageQueue>> UpdateAsync(string resourceGroupName, string accountName, string queue |
| | 204 | | { |
| 0 | 205 | | if (resourceGroupName == null) |
| | 206 | | { |
| 0 | 207 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 208 | | } |
| 0 | 209 | | if (accountName == null) |
| | 210 | | { |
| 0 | 211 | | throw new ArgumentNullException(nameof(accountName)); |
| | 212 | | } |
| 0 | 213 | | if (queueName == null) |
| | 214 | | { |
| 0 | 215 | | throw new ArgumentNullException(nameof(queueName)); |
| | 216 | | } |
| 0 | 217 | | if (queue == null) |
| | 218 | | { |
| 0 | 219 | | throw new ArgumentNullException(nameof(queue)); |
| | 220 | | } |
| | 221 | |
|
| 0 | 222 | | using var message = CreateUpdateRequest(resourceGroupName, accountName, queueName, queue); |
| 0 | 223 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 224 | | switch (message.Response.Status) |
| | 225 | | { |
| | 226 | | case 200: |
| | 227 | | { |
| 0 | 228 | | StorageQueue value = default; |
| 0 | 229 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 230 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 231 | | { |
| 0 | 232 | | value = null; |
| | 233 | | } |
| | 234 | | else |
| | 235 | | { |
| 0 | 236 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 237 | | } |
| 0 | 238 | | return Response.FromValue(value, message.Response); |
| | 239 | | } |
| | 240 | | default: |
| 0 | 241 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 242 | | } |
| 0 | 243 | | } |
| | 244 | |
|
| | 245 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 246 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 247 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 248 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 249 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 250 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 251 | | public Response<StorageQueue> Update(string resourceGroupName, string accountName, string queueName, StorageQueu |
| | 252 | | { |
| 0 | 253 | | if (resourceGroupName == null) |
| | 254 | | { |
| 0 | 255 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 256 | | } |
| 0 | 257 | | if (accountName == null) |
| | 258 | | { |
| 0 | 259 | | throw new ArgumentNullException(nameof(accountName)); |
| | 260 | | } |
| 0 | 261 | | if (queueName == null) |
| | 262 | | { |
| 0 | 263 | | throw new ArgumentNullException(nameof(queueName)); |
| | 264 | | } |
| 0 | 265 | | if (queue == null) |
| | 266 | | { |
| 0 | 267 | | throw new ArgumentNullException(nameof(queue)); |
| | 268 | | } |
| | 269 | |
|
| 0 | 270 | | using var message = CreateUpdateRequest(resourceGroupName, accountName, queueName, queue); |
| 0 | 271 | | _pipeline.Send(message, cancellationToken); |
| 0 | 272 | | switch (message.Response.Status) |
| | 273 | | { |
| | 274 | | case 200: |
| | 275 | | { |
| 0 | 276 | | StorageQueue value = default; |
| 0 | 277 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 278 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 279 | | { |
| 0 | 280 | | value = null; |
| | 281 | | } |
| | 282 | | else |
| | 283 | | { |
| 0 | 284 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 285 | | } |
| 0 | 286 | | return Response.FromValue(value, message.Response); |
| | 287 | | } |
| | 288 | | default: |
| 0 | 289 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 290 | | } |
| 0 | 291 | | } |
| | 292 | |
|
| | 293 | | internal HttpMessage CreateGetRequest(string resourceGroupName, string accountName, string queueName) |
| | 294 | | { |
| 0 | 295 | | var message = _pipeline.CreateMessage(); |
| 0 | 296 | | var request = message.Request; |
| 0 | 297 | | request.Method = RequestMethod.Get; |
| 0 | 298 | | var uri = new RawRequestUriBuilder(); |
| 0 | 299 | | uri.Reset(endpoint); |
| 0 | 300 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 301 | | uri.AppendPath(subscriptionId, true); |
| 0 | 302 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 303 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 304 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 305 | | uri.AppendPath(accountName, true); |
| 0 | 306 | | uri.AppendPath("/queueServices/default/queues/", false); |
| 0 | 307 | | uri.AppendPath(queueName, true); |
| 0 | 308 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 309 | | request.Uri = uri; |
| 0 | 310 | | return message; |
| | 311 | | } |
| | 312 | |
|
| | 313 | | /// <summary> Gets the queue with the specified queue name, under the specified account if it exists. </summary> |
| | 314 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 315 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 316 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 317 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 318 | | public async Task<Response<StorageQueue>> GetAsync(string resourceGroupName, string accountName, string queueNam |
| | 319 | | { |
| 0 | 320 | | if (resourceGroupName == null) |
| | 321 | | { |
| 0 | 322 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 323 | | } |
| 0 | 324 | | if (accountName == null) |
| | 325 | | { |
| 0 | 326 | | throw new ArgumentNullException(nameof(accountName)); |
| | 327 | | } |
| 0 | 328 | | if (queueName == null) |
| | 329 | | { |
| 0 | 330 | | throw new ArgumentNullException(nameof(queueName)); |
| | 331 | | } |
| | 332 | |
|
| 0 | 333 | | using var message = CreateGetRequest(resourceGroupName, accountName, queueName); |
| 0 | 334 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 335 | | switch (message.Response.Status) |
| | 336 | | { |
| | 337 | | case 200: |
| | 338 | | { |
| 0 | 339 | | StorageQueue value = default; |
| 0 | 340 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 341 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 342 | | { |
| 0 | 343 | | value = null; |
| | 344 | | } |
| | 345 | | else |
| | 346 | | { |
| 0 | 347 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 348 | | } |
| 0 | 349 | | return Response.FromValue(value, message.Response); |
| | 350 | | } |
| | 351 | | default: |
| 0 | 352 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 353 | | } |
| 0 | 354 | | } |
| | 355 | |
|
| | 356 | | /// <summary> Gets the queue with the specified queue name, under the specified account if it exists. </summary> |
| | 357 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 358 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 359 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 360 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 361 | | public Response<StorageQueue> Get(string resourceGroupName, string accountName, string queueName, CancellationTo |
| | 362 | | { |
| 0 | 363 | | if (resourceGroupName == null) |
| | 364 | | { |
| 0 | 365 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 366 | | } |
| 0 | 367 | | if (accountName == null) |
| | 368 | | { |
| 0 | 369 | | throw new ArgumentNullException(nameof(accountName)); |
| | 370 | | } |
| 0 | 371 | | if (queueName == null) |
| | 372 | | { |
| 0 | 373 | | throw new ArgumentNullException(nameof(queueName)); |
| | 374 | | } |
| | 375 | |
|
| 0 | 376 | | using var message = CreateGetRequest(resourceGroupName, accountName, queueName); |
| 0 | 377 | | _pipeline.Send(message, cancellationToken); |
| 0 | 378 | | switch (message.Response.Status) |
| | 379 | | { |
| | 380 | | case 200: |
| | 381 | | { |
| 0 | 382 | | StorageQueue value = default; |
| 0 | 383 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 384 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 385 | | { |
| 0 | 386 | | value = null; |
| | 387 | | } |
| | 388 | | else |
| | 389 | | { |
| 0 | 390 | | value = StorageQueue.DeserializeStorageQueue(document.RootElement); |
| | 391 | | } |
| 0 | 392 | | return Response.FromValue(value, message.Response); |
| | 393 | | } |
| | 394 | | default: |
| 0 | 395 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 396 | | } |
| 0 | 397 | | } |
| | 398 | |
|
| | 399 | | internal HttpMessage CreateDeleteRequest(string resourceGroupName, string accountName, string queueName) |
| | 400 | | { |
| 0 | 401 | | var message = _pipeline.CreateMessage(); |
| 0 | 402 | | var request = message.Request; |
| 0 | 403 | | request.Method = RequestMethod.Delete; |
| 0 | 404 | | var uri = new RawRequestUriBuilder(); |
| 0 | 405 | | uri.Reset(endpoint); |
| 0 | 406 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 407 | | uri.AppendPath(subscriptionId, true); |
| 0 | 408 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 409 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 410 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 411 | | uri.AppendPath(accountName, true); |
| 0 | 412 | | uri.AppendPath("/queueServices/default/queues/", false); |
| 0 | 413 | | uri.AppendPath(queueName, true); |
| 0 | 414 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 415 | | request.Uri = uri; |
| 0 | 416 | | return message; |
| | 417 | | } |
| | 418 | |
|
| | 419 | | /// <summary> Deletes the queue with the specified queue name, under the specified account if it exists. </summa |
| | 420 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 421 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 422 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 423 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 424 | | public async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string queueName, Cancella |
| | 425 | | { |
| 0 | 426 | | if (resourceGroupName == null) |
| | 427 | | { |
| 0 | 428 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 429 | | } |
| 0 | 430 | | if (accountName == null) |
| | 431 | | { |
| 0 | 432 | | throw new ArgumentNullException(nameof(accountName)); |
| | 433 | | } |
| 0 | 434 | | if (queueName == null) |
| | 435 | | { |
| 0 | 436 | | throw new ArgumentNullException(nameof(queueName)); |
| | 437 | | } |
| | 438 | |
|
| 0 | 439 | | using var message = CreateDeleteRequest(resourceGroupName, accountName, queueName); |
| 0 | 440 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 441 | | switch (message.Response.Status) |
| | 442 | | { |
| | 443 | | case 204: |
| 0 | 444 | | return message.Response; |
| | 445 | | default: |
| 0 | 446 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 447 | | } |
| 0 | 448 | | } |
| | 449 | |
|
| | 450 | | /// <summary> Deletes the queue with the specified queue name, under the specified account if it exists. </summa |
| | 451 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 452 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 453 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 454 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 455 | | public Response Delete(string resourceGroupName, string accountName, string queueName, CancellationToken cancell |
| | 456 | | { |
| 0 | 457 | | if (resourceGroupName == null) |
| | 458 | | { |
| 0 | 459 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 460 | | } |
| 0 | 461 | | if (accountName == null) |
| | 462 | | { |
| 0 | 463 | | throw new ArgumentNullException(nameof(accountName)); |
| | 464 | | } |
| 0 | 465 | | if (queueName == null) |
| | 466 | | { |
| 0 | 467 | | throw new ArgumentNullException(nameof(queueName)); |
| | 468 | | } |
| | 469 | |
|
| 0 | 470 | | using var message = CreateDeleteRequest(resourceGroupName, accountName, queueName); |
| 0 | 471 | | _pipeline.Send(message, cancellationToken); |
| 0 | 472 | | switch (message.Response.Status) |
| | 473 | | { |
| | 474 | | case 204: |
| 0 | 475 | | return message.Response; |
| | 476 | | default: |
| 0 | 477 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 478 | | } |
| 0 | 479 | | } |
| | 480 | |
|
| | 481 | | internal HttpMessage CreateListRequest(string resourceGroupName, string accountName, string maxpagesize, string |
| | 482 | | { |
| 0 | 483 | | var message = _pipeline.CreateMessage(); |
| 0 | 484 | | var request = message.Request; |
| 0 | 485 | | request.Method = RequestMethod.Get; |
| 0 | 486 | | var uri = new RawRequestUriBuilder(); |
| 0 | 487 | | uri.Reset(endpoint); |
| 0 | 488 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 489 | | uri.AppendPath(subscriptionId, true); |
| 0 | 490 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 491 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 492 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 493 | | uri.AppendPath(accountName, true); |
| 0 | 494 | | uri.AppendPath("/queueServices/default/queues", false); |
| 0 | 495 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 496 | | if (maxpagesize != null) |
| | 497 | | { |
| 0 | 498 | | uri.AppendQuery("$maxpagesize", maxpagesize, true); |
| | 499 | | } |
| 0 | 500 | | if (filter != null) |
| | 501 | | { |
| 0 | 502 | | uri.AppendQuery("$filter", filter, true); |
| | 503 | | } |
| 0 | 504 | | request.Uri = uri; |
| 0 | 505 | | return message; |
| | 506 | | } |
| | 507 | |
|
| | 508 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 509 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 510 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 511 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 512 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 513 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 514 | | public async Task<Response<ListQueueResource>> ListAsync(string resourceGroupName, string accountName, string ma |
| | 515 | | { |
| 0 | 516 | | if (resourceGroupName == null) |
| | 517 | | { |
| 0 | 518 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 519 | | } |
| 0 | 520 | | if (accountName == null) |
| | 521 | | { |
| 0 | 522 | | throw new ArgumentNullException(nameof(accountName)); |
| | 523 | | } |
| | 524 | |
|
| 0 | 525 | | using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter); |
| 0 | 526 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 527 | | switch (message.Response.Status) |
| | 528 | | { |
| | 529 | | case 200: |
| | 530 | | { |
| 0 | 531 | | ListQueueResource value = default; |
| 0 | 532 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 533 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 534 | | { |
| 0 | 535 | | value = null; |
| | 536 | | } |
| | 537 | | else |
| | 538 | | { |
| 0 | 539 | | value = ListQueueResource.DeserializeListQueueResource(document.RootElement); |
| | 540 | | } |
| 0 | 541 | | return Response.FromValue(value, message.Response); |
| | 542 | | } |
| | 543 | | default: |
| 0 | 544 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 545 | | } |
| 0 | 546 | | } |
| | 547 | |
|
| | 548 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 549 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 550 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 551 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 552 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 553 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 554 | | public Response<ListQueueResource> List(string resourceGroupName, string accountName, string maxpagesize = null, |
| | 555 | | { |
| 0 | 556 | | if (resourceGroupName == null) |
| | 557 | | { |
| 0 | 558 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 559 | | } |
| 0 | 560 | | if (accountName == null) |
| | 561 | | { |
| 0 | 562 | | throw new ArgumentNullException(nameof(accountName)); |
| | 563 | | } |
| | 564 | |
|
| 0 | 565 | | using var message = CreateListRequest(resourceGroupName, accountName, maxpagesize, filter); |
| 0 | 566 | | _pipeline.Send(message, cancellationToken); |
| 0 | 567 | | switch (message.Response.Status) |
| | 568 | | { |
| | 569 | | case 200: |
| | 570 | | { |
| 0 | 571 | | ListQueueResource value = default; |
| 0 | 572 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 573 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 574 | | { |
| 0 | 575 | | value = null; |
| | 576 | | } |
| | 577 | | else |
| | 578 | | { |
| 0 | 579 | | value = ListQueueResource.DeserializeListQueueResource(document.RootElement); |
| | 580 | | } |
| 0 | 581 | | return Response.FromValue(value, message.Response); |
| | 582 | | } |
| | 583 | | default: |
| 0 | 584 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 585 | | } |
| 0 | 586 | | } |
| | 587 | |
|
| | 588 | | internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceGroupName, string accountName, st |
| | 589 | | { |
| 0 | 590 | | var message = _pipeline.CreateMessage(); |
| 0 | 591 | | var request = message.Request; |
| 0 | 592 | | request.Method = RequestMethod.Get; |
| 0 | 593 | | var uri = new RawRequestUriBuilder(); |
| 0 | 594 | | uri.Reset(endpoint); |
| 0 | 595 | | uri.AppendRawNextLink(nextLink, false); |
| 0 | 596 | | request.Uri = uri; |
| 0 | 597 | | return message; |
| | 598 | | } |
| | 599 | |
|
| | 600 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 601 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 602 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 603 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 604 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 605 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 606 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 607 | | public async Task<Response<ListQueueResource>> ListNextPageAsync(string nextLink, string resourceGroupName, stri |
| | 608 | | { |
| 0 | 609 | | if (nextLink == null) |
| | 610 | | { |
| 0 | 611 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 612 | | } |
| 0 | 613 | | if (resourceGroupName == null) |
| | 614 | | { |
| 0 | 615 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 616 | | } |
| 0 | 617 | | if (accountName == null) |
| | 618 | | { |
| 0 | 619 | | throw new ArgumentNullException(nameof(accountName)); |
| | 620 | | } |
| | 621 | |
|
| 0 | 622 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter) |
| 0 | 623 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 624 | | switch (message.Response.Status) |
| | 625 | | { |
| | 626 | | case 200: |
| | 627 | | { |
| 0 | 628 | | ListQueueResource value = default; |
| 0 | 629 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 630 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 631 | | { |
| 0 | 632 | | value = null; |
| | 633 | | } |
| | 634 | | else |
| | 635 | | { |
| 0 | 636 | | value = ListQueueResource.DeserializeListQueueResource(document.RootElement); |
| | 637 | | } |
| 0 | 638 | | return Response.FromValue(value, message.Response); |
| | 639 | | } |
| | 640 | | default: |
| 0 | 641 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 642 | | } |
| 0 | 643 | | } |
| | 644 | |
|
| | 645 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 646 | | /// <param name="nextLink"> The URL to the next page of results. </param> |
| | 647 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 648 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 649 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 650 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 651 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 652 | | public Response<ListQueueResource> ListNextPage(string nextLink, string resourceGroupName, string accountName, s |
| | 653 | | { |
| 0 | 654 | | if (nextLink == null) |
| | 655 | | { |
| 0 | 656 | | throw new ArgumentNullException(nameof(nextLink)); |
| | 657 | | } |
| 0 | 658 | | if (resourceGroupName == null) |
| | 659 | | { |
| 0 | 660 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 661 | | } |
| 0 | 662 | | if (accountName == null) |
| | 663 | | { |
| 0 | 664 | | throw new ArgumentNullException(nameof(accountName)); |
| | 665 | | } |
| | 666 | |
|
| 0 | 667 | | using var message = CreateListNextPageRequest(nextLink, resourceGroupName, accountName, maxpagesize, filter) |
| 0 | 668 | | _pipeline.Send(message, cancellationToken); |
| 0 | 669 | | switch (message.Response.Status) |
| | 670 | | { |
| | 671 | | case 200: |
| | 672 | | { |
| 0 | 673 | | ListQueueResource value = default; |
| 0 | 674 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 675 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 676 | | { |
| 0 | 677 | | value = null; |
| | 678 | | } |
| | 679 | | else |
| | 680 | | { |
| 0 | 681 | | value = ListQueueResource.DeserializeListQueueResource(document.RootElement); |
| | 682 | | } |
| 0 | 683 | | return Response.FromValue(value, message.Response); |
| | 684 | | } |
| | 685 | | default: |
| 0 | 686 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 687 | | } |
| 0 | 688 | | } |
| | 689 | | } |
| | 690 | | } |