| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Threading; |
| | 10 | | using System.Threading.Tasks; |
| | 11 | | using Azure; |
| | 12 | | using Azure.Core; |
| | 13 | | using Azure.Core.Pipeline; |
| | 14 | | using Azure.ResourceManager.Storage.Models; |
| | 15 | |
|
| | 16 | | namespace Azure.ResourceManager.Storage |
| | 17 | | { |
| | 18 | | /// <summary> The Queue service client. </summary> |
| | 19 | | public partial class QueueOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal QueueRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of QueueOperations for mocking. </summary> |
| 0 | 25 | | protected QueueOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of QueueOperations. </summary> |
| | 29 | | /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param> |
| | 30 | | /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param> |
| | 31 | | /// <param name="subscriptionId"> The ID of the target subscription. </param> |
| | 32 | | /// <param name="endpoint"> server parameter. </param> |
| | 33 | | /// <param name="apiVersion"> Api Version. </param> |
| 0 | 34 | | internal QueueOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri |
| | 35 | | { |
| 0 | 36 | | RestClient = new QueueRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); |
| 0 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 38 | | _pipeline = pipeline; |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 42 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 43 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 44 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 45 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 46 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 47 | | public virtual async Task<Response<StorageQueue>> CreateAsync(string resourceGroupName, string accountName, stri |
| | 48 | | { |
| 0 | 49 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Create"); |
| 0 | 50 | | scope.Start(); |
| | 51 | | try |
| | 52 | | { |
| 0 | 53 | | return await RestClient.CreateAsync(resourceGroupName, accountName, queueName, queue, cancellationToken) |
| | 54 | | } |
| 0 | 55 | | catch (Exception e) |
| | 56 | | { |
| 0 | 57 | | scope.Failed(e); |
| 0 | 58 | | throw; |
| | 59 | | } |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 63 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 64 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 65 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 66 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 67 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 68 | | public virtual Response<StorageQueue> Create(string resourceGroupName, string accountName, string queueName, Sto |
| | 69 | | { |
| 0 | 70 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Create"); |
| 0 | 71 | | scope.Start(); |
| | 72 | | try |
| | 73 | | { |
| 0 | 74 | | return RestClient.Create(resourceGroupName, accountName, queueName, queue, cancellationToken); |
| | 75 | | } |
| 0 | 76 | | catch (Exception e) |
| | 77 | | { |
| 0 | 78 | | scope.Failed(e); |
| 0 | 79 | | throw; |
| | 80 | | } |
| 0 | 81 | | } |
| | 82 | |
|
| | 83 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 84 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 85 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 86 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 87 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 88 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 89 | | public virtual async Task<Response<StorageQueue>> UpdateAsync(string resourceGroupName, string accountName, stri |
| | 90 | | { |
| 0 | 91 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Update"); |
| 0 | 92 | | scope.Start(); |
| | 93 | | try |
| | 94 | | { |
| 0 | 95 | | return await RestClient.UpdateAsync(resourceGroupName, accountName, queueName, queue, cancellationToken) |
| | 96 | | } |
| 0 | 97 | | catch (Exception e) |
| | 98 | | { |
| 0 | 99 | | scope.Failed(e); |
| 0 | 100 | | throw; |
| | 101 | | } |
| 0 | 102 | | } |
| | 103 | |
|
| | 104 | | /// <summary> Creates a new queue with the specified queue name, under the specified account. </summary> |
| | 105 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 106 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 107 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 108 | | /// <param name="queue"> Queue properties and metadata to be created with. </param> |
| | 109 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 110 | | public virtual Response<StorageQueue> Update(string resourceGroupName, string accountName, string queueName, Sto |
| | 111 | | { |
| 0 | 112 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Update"); |
| 0 | 113 | | scope.Start(); |
| | 114 | | try |
| | 115 | | { |
| 0 | 116 | | return RestClient.Update(resourceGroupName, accountName, queueName, queue, cancellationToken); |
| | 117 | | } |
| 0 | 118 | | catch (Exception e) |
| | 119 | | { |
| 0 | 120 | | scope.Failed(e); |
| 0 | 121 | | throw; |
| | 122 | | } |
| 0 | 123 | | } |
| | 124 | |
|
| | 125 | | /// <summary> Gets the queue with the specified queue name, under the specified account if it exists. </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="cancellationToken"> The cancellation token to use. </param> |
| | 130 | | public virtual async Task<Response<StorageQueue>> GetAsync(string resourceGroupName, string accountName, string |
| | 131 | | { |
| 0 | 132 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Get"); |
| 0 | 133 | | scope.Start(); |
| | 134 | | try |
| | 135 | | { |
| 0 | 136 | | return await RestClient.GetAsync(resourceGroupName, accountName, queueName, cancellationToken).Configure |
| | 137 | | } |
| 0 | 138 | | catch (Exception e) |
| | 139 | | { |
| 0 | 140 | | scope.Failed(e); |
| 0 | 141 | | throw; |
| | 142 | | } |
| 0 | 143 | | } |
| | 144 | |
|
| | 145 | | /// <summary> Gets the queue with the specified queue name, under the specified account if it exists. </summary> |
| | 146 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 147 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 148 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 149 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 150 | | public virtual Response<StorageQueue> Get(string resourceGroupName, string accountName, string queueName, Cancel |
| | 151 | | { |
| 0 | 152 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Get"); |
| 0 | 153 | | scope.Start(); |
| | 154 | | try |
| | 155 | | { |
| 0 | 156 | | return RestClient.Get(resourceGroupName, accountName, queueName, cancellationToken); |
| | 157 | | } |
| 0 | 158 | | catch (Exception e) |
| | 159 | | { |
| 0 | 160 | | scope.Failed(e); |
| 0 | 161 | | throw; |
| | 162 | | } |
| 0 | 163 | | } |
| | 164 | |
|
| | 165 | | /// <summary> Deletes the queue with the specified queue name, under the specified account if it exists. </summa |
| | 166 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 167 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 168 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 169 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 170 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string queueName, |
| | 171 | | { |
| 0 | 172 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Delete"); |
| 0 | 173 | | scope.Start(); |
| | 174 | | try |
| | 175 | | { |
| 0 | 176 | | return await RestClient.DeleteAsync(resourceGroupName, accountName, queueName, cancellationToken).Config |
| | 177 | | } |
| 0 | 178 | | catch (Exception e) |
| | 179 | | { |
| 0 | 180 | | scope.Failed(e); |
| 0 | 181 | | throw; |
| | 182 | | } |
| 0 | 183 | | } |
| | 184 | |
|
| | 185 | | /// <summary> Deletes the queue with the specified queue name, under the specified account if it exists. </summa |
| | 186 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 187 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 188 | | /// <param name="queueName"> A queue name must be unique within a storage account and must be between 3 and 63 c |
| | 189 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 190 | | public virtual Response Delete(string resourceGroupName, string accountName, string queueName, CancellationToken |
| | 191 | | { |
| 0 | 192 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.Delete"); |
| 0 | 193 | | scope.Start(); |
| | 194 | | try |
| | 195 | | { |
| 0 | 196 | | return RestClient.Delete(resourceGroupName, accountName, queueName, cancellationToken); |
| | 197 | | } |
| 0 | 198 | | catch (Exception e) |
| | 199 | | { |
| 0 | 200 | | scope.Failed(e); |
| 0 | 201 | | throw; |
| | 202 | | } |
| 0 | 203 | | } |
| | 204 | |
|
| | 205 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 206 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 207 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 208 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 209 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 210 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 211 | | public virtual AsyncPageable<ListQueue> ListAsync(string resourceGroupName, string accountName, string maxpagesi |
| | 212 | | { |
| 0 | 213 | | if (resourceGroupName == null) |
| | 214 | | { |
| 0 | 215 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 216 | | } |
| 0 | 217 | | if (accountName == null) |
| | 218 | | { |
| 0 | 219 | | throw new ArgumentNullException(nameof(accountName)); |
| | 220 | | } |
| | 221 | |
|
| | 222 | | async Task<Page<ListQueue>> FirstPageFunc(int? pageSizeHint) |
| | 223 | | { |
| 0 | 224 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.List"); |
| 0 | 225 | | scope.Start(); |
| | 226 | | try |
| | 227 | | { |
| 0 | 228 | | var response = await RestClient.ListAsync(resourceGroupName, accountName, maxpagesize, filter, cance |
| 0 | 229 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 230 | | } |
| 0 | 231 | | catch (Exception e) |
| | 232 | | { |
| 0 | 233 | | scope.Failed(e); |
| 0 | 234 | | throw; |
| | 235 | | } |
| 0 | 236 | | } |
| | 237 | | async Task<Page<ListQueue>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 238 | | { |
| 0 | 239 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.List"); |
| 0 | 240 | | scope.Start(); |
| | 241 | | try |
| | 242 | | { |
| 0 | 243 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, maxpages |
| 0 | 244 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 245 | | } |
| 0 | 246 | | catch (Exception e) |
| | 247 | | { |
| 0 | 248 | | scope.Failed(e); |
| 0 | 249 | | throw; |
| | 250 | | } |
| 0 | 251 | | } |
| 0 | 252 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 253 | | } |
| | 254 | |
|
| | 255 | | /// <summary> Gets a list of all the queues under the specified storage account. </summary> |
| | 256 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 257 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 258 | | /// <param name="maxpagesize"> Optional, a maximum number of queues that should be included in a list queue resp |
| | 259 | | /// <param name="filter"> Optional, When specified, only the queues with a name starting with the given filter w |
| | 260 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 261 | | public virtual Pageable<ListQueue> List(string resourceGroupName, string accountName, string maxpagesize = null, |
| | 262 | | { |
| 0 | 263 | | if (resourceGroupName == null) |
| | 264 | | { |
| 0 | 265 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 266 | | } |
| 0 | 267 | | if (accountName == null) |
| | 268 | | { |
| 0 | 269 | | throw new ArgumentNullException(nameof(accountName)); |
| | 270 | | } |
| | 271 | |
|
| | 272 | | Page<ListQueue> FirstPageFunc(int? pageSizeHint) |
| | 273 | | { |
| 0 | 274 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.List"); |
| 0 | 275 | | scope.Start(); |
| | 276 | | try |
| | 277 | | { |
| 0 | 278 | | var response = RestClient.List(resourceGroupName, accountName, maxpagesize, filter, cancellationToke |
| 0 | 279 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 280 | | } |
| 0 | 281 | | catch (Exception e) |
| | 282 | | { |
| 0 | 283 | | scope.Failed(e); |
| 0 | 284 | | throw; |
| | 285 | | } |
| 0 | 286 | | } |
| | 287 | | Page<ListQueue> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 288 | | { |
| 0 | 289 | | using var scope = _clientDiagnostics.CreateScope("QueueOperations.List"); |
| 0 | 290 | | scope.Start(); |
| | 291 | | try |
| | 292 | | { |
| 0 | 293 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, maxpagesize, filter |
| 0 | 294 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 295 | | } |
| 0 | 296 | | catch (Exception e) |
| | 297 | | { |
| 0 | 298 | | scope.Failed(e); |
| 0 | 299 | | throw; |
| | 300 | | } |
| 0 | 301 | | } |
| 0 | 302 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 303 | | } |
| | 304 | | } |
| | 305 | | } |