| | 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 QueueServicesRestOperations |
| | 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 QueueServicesRestOperations. </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 QueueServicesRestOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | 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 CreateListRequest(string resourceGroupName, string accountName) |
| | 54 | | { |
| 0 | 55 | | var message = _pipeline.CreateMessage(); |
| 0 | 56 | | var request = message.Request; |
| 0 | 57 | | request.Method = RequestMethod.Get; |
| 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", false); |
| 0 | 67 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 68 | | request.Uri = uri; |
| 0 | 69 | | return message; |
| | 70 | | } |
| | 71 | |
|
| | 72 | | /// <summary> List all queue services for the storage account. </summary> |
| | 73 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 74 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 75 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 76 | | public async Task<Response<ListQueueServices>> ListAsync(string resourceGroupName, string accountName, Cancellat |
| | 77 | | { |
| 0 | 78 | | if (resourceGroupName == null) |
| | 79 | | { |
| 0 | 80 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 81 | | } |
| 0 | 82 | | if (accountName == null) |
| | 83 | | { |
| 0 | 84 | | throw new ArgumentNullException(nameof(accountName)); |
| | 85 | | } |
| | 86 | |
|
| 0 | 87 | | using var message = CreateListRequest(resourceGroupName, accountName); |
| 0 | 88 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 89 | | switch (message.Response.Status) |
| | 90 | | { |
| | 91 | | case 200: |
| | 92 | | { |
| 0 | 93 | | ListQueueServices value = default; |
| 0 | 94 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 95 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 96 | | { |
| 0 | 97 | | value = null; |
| | 98 | | } |
| | 99 | | else |
| | 100 | | { |
| 0 | 101 | | value = ListQueueServices.DeserializeListQueueServices(document.RootElement); |
| | 102 | | } |
| 0 | 103 | | return Response.FromValue(value, message.Response); |
| | 104 | | } |
| | 105 | | default: |
| 0 | 106 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 107 | | } |
| 0 | 108 | | } |
| | 109 | |
|
| | 110 | | /// <summary> List all queue services for the storage account. </summary> |
| | 111 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 112 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 113 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 114 | | public Response<ListQueueServices> List(string resourceGroupName, string accountName, CancellationToken cancella |
| | 115 | | { |
| 0 | 116 | | if (resourceGroupName == null) |
| | 117 | | { |
| 0 | 118 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 119 | | } |
| 0 | 120 | | if (accountName == null) |
| | 121 | | { |
| 0 | 122 | | throw new ArgumentNullException(nameof(accountName)); |
| | 123 | | } |
| | 124 | |
|
| 0 | 125 | | using var message = CreateListRequest(resourceGroupName, accountName); |
| 0 | 126 | | _pipeline.Send(message, cancellationToken); |
| 0 | 127 | | switch (message.Response.Status) |
| | 128 | | { |
| | 129 | | case 200: |
| | 130 | | { |
| 0 | 131 | | ListQueueServices value = default; |
| 0 | 132 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 133 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 134 | | { |
| 0 | 135 | | value = null; |
| | 136 | | } |
| | 137 | | else |
| | 138 | | { |
| 0 | 139 | | value = ListQueueServices.DeserializeListQueueServices(document.RootElement); |
| | 140 | | } |
| 0 | 141 | | return Response.FromValue(value, message.Response); |
| | 142 | | } |
| | 143 | | default: |
| 0 | 144 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 145 | | } |
| 0 | 146 | | } |
| | 147 | |
|
| | 148 | | internal HttpMessage CreateSetServicePropertiesRequest(string resourceGroupName, string accountName, QueueServic |
| | 149 | | { |
| 0 | 150 | | var message = _pipeline.CreateMessage(); |
| 0 | 151 | | var request = message.Request; |
| 0 | 152 | | request.Method = RequestMethod.Put; |
| 0 | 153 | | var uri = new RawRequestUriBuilder(); |
| 0 | 154 | | uri.Reset(endpoint); |
| 0 | 155 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 156 | | uri.AppendPath(subscriptionId, true); |
| 0 | 157 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 158 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 159 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 160 | | uri.AppendPath(accountName, true); |
| 0 | 161 | | uri.AppendPath("/queueServices/", false); |
| 0 | 162 | | uri.AppendPath("default", true); |
| 0 | 163 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 164 | | request.Uri = uri; |
| 0 | 165 | | request.Headers.Add("Content-Type", "application/json"); |
| 0 | 166 | | var content = new Utf8JsonRequestContent(); |
| 0 | 167 | | content.JsonWriter.WriteObjectValue(parameters); |
| 0 | 168 | | request.Content = content; |
| 0 | 169 | | return message; |
| | 170 | | } |
| | 171 | |
|
| | 172 | | /// <summary> Sets the properties of a storage account’s Queue service, including properties for Storage Analyti |
| | 173 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 174 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 175 | | /// <param name="parameters"> The properties of a storage account’s Queue service, only properties for Storage A |
| | 176 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 177 | | public async Task<Response<QueueServiceProperties>> SetServicePropertiesAsync(string resourceGroupName, string a |
| | 178 | | { |
| 0 | 179 | | if (resourceGroupName == null) |
| | 180 | | { |
| 0 | 181 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 182 | | } |
| 0 | 183 | | if (accountName == null) |
| | 184 | | { |
| 0 | 185 | | throw new ArgumentNullException(nameof(accountName)); |
| | 186 | | } |
| 0 | 187 | | if (parameters == null) |
| | 188 | | { |
| 0 | 189 | | throw new ArgumentNullException(nameof(parameters)); |
| | 190 | | } |
| | 191 | |
|
| 0 | 192 | | using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters); |
| 0 | 193 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 194 | | switch (message.Response.Status) |
| | 195 | | { |
| | 196 | | case 200: |
| | 197 | | { |
| 0 | 198 | | QueueServiceProperties value = default; |
| 0 | 199 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 200 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 201 | | { |
| 0 | 202 | | value = null; |
| | 203 | | } |
| | 204 | | else |
| | 205 | | { |
| 0 | 206 | | value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement); |
| | 207 | | } |
| 0 | 208 | | return Response.FromValue(value, message.Response); |
| | 209 | | } |
| | 210 | | default: |
| 0 | 211 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 212 | | } |
| 0 | 213 | | } |
| | 214 | |
|
| | 215 | | /// <summary> Sets the properties of a storage account’s Queue service, including properties for Storage Analyti |
| | 216 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 217 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 218 | | /// <param name="parameters"> The properties of a storage account’s Queue service, only properties for Storage A |
| | 219 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 220 | | public Response<QueueServiceProperties> SetServiceProperties(string resourceGroupName, string accountName, Queue |
| | 221 | | { |
| 0 | 222 | | if (resourceGroupName == null) |
| | 223 | | { |
| 0 | 224 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 225 | | } |
| 0 | 226 | | if (accountName == null) |
| | 227 | | { |
| 0 | 228 | | throw new ArgumentNullException(nameof(accountName)); |
| | 229 | | } |
| 0 | 230 | | if (parameters == null) |
| | 231 | | { |
| 0 | 232 | | throw new ArgumentNullException(nameof(parameters)); |
| | 233 | | } |
| | 234 | |
|
| 0 | 235 | | using var message = CreateSetServicePropertiesRequest(resourceGroupName, accountName, parameters); |
| 0 | 236 | | _pipeline.Send(message, cancellationToken); |
| 0 | 237 | | switch (message.Response.Status) |
| | 238 | | { |
| | 239 | | case 200: |
| | 240 | | { |
| 0 | 241 | | QueueServiceProperties value = default; |
| 0 | 242 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 243 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 244 | | { |
| 0 | 245 | | value = null; |
| | 246 | | } |
| | 247 | | else |
| | 248 | | { |
| 0 | 249 | | value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement); |
| | 250 | | } |
| 0 | 251 | | return Response.FromValue(value, message.Response); |
| | 252 | | } |
| | 253 | | default: |
| 0 | 254 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 255 | | } |
| 0 | 256 | | } |
| | 257 | |
|
| | 258 | | internal HttpMessage CreateGetServicePropertiesRequest(string resourceGroupName, string accountName) |
| | 259 | | { |
| 0 | 260 | | var message = _pipeline.CreateMessage(); |
| 0 | 261 | | var request = message.Request; |
| 0 | 262 | | request.Method = RequestMethod.Get; |
| 0 | 263 | | var uri = new RawRequestUriBuilder(); |
| 0 | 264 | | uri.Reset(endpoint); |
| 0 | 265 | | uri.AppendPath("/subscriptions/", false); |
| 0 | 266 | | uri.AppendPath(subscriptionId, true); |
| 0 | 267 | | uri.AppendPath("/resourceGroups/", false); |
| 0 | 268 | | uri.AppendPath(resourceGroupName, true); |
| 0 | 269 | | uri.AppendPath("/providers/Microsoft.Storage/storageAccounts/", false); |
| 0 | 270 | | uri.AppendPath(accountName, true); |
| 0 | 271 | | uri.AppendPath("/queueServices/", false); |
| 0 | 272 | | uri.AppendPath("default", true); |
| 0 | 273 | | uri.AppendQuery("api-version", apiVersion, true); |
| 0 | 274 | | request.Uri = uri; |
| 0 | 275 | | return message; |
| | 276 | | } |
| | 277 | |
|
| | 278 | | /// <summary> Gets the properties of a storage account’s Queue service, including properties for Storage Analyti |
| | 279 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 280 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 281 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 282 | | public async Task<Response<QueueServiceProperties>> GetServicePropertiesAsync(string resourceGroupName, string a |
| | 283 | | { |
| 0 | 284 | | if (resourceGroupName == null) |
| | 285 | | { |
| 0 | 286 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 287 | | } |
| 0 | 288 | | if (accountName == null) |
| | 289 | | { |
| 0 | 290 | | throw new ArgumentNullException(nameof(accountName)); |
| | 291 | | } |
| | 292 | |
|
| 0 | 293 | | using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName); |
| 0 | 294 | | await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); |
| 0 | 295 | | switch (message.Response.Status) |
| | 296 | | { |
| | 297 | | case 200: |
| | 298 | | { |
| 0 | 299 | | QueueServiceProperties value = default; |
| 0 | 300 | | using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, canc |
| 0 | 301 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 302 | | { |
| 0 | 303 | | value = null; |
| | 304 | | } |
| | 305 | | else |
| | 306 | | { |
| 0 | 307 | | value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement); |
| | 308 | | } |
| 0 | 309 | | return Response.FromValue(value, message.Response); |
| | 310 | | } |
| | 311 | | default: |
| 0 | 312 | | throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(fa |
| | 313 | | } |
| 0 | 314 | | } |
| | 315 | |
|
| | 316 | | /// <summary> Gets the properties of a storage account’s Queue service, including properties for Storage Analyti |
| | 317 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 318 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 319 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 320 | | public Response<QueueServiceProperties> GetServiceProperties(string resourceGroupName, string accountName, Cance |
| | 321 | | { |
| 0 | 322 | | if (resourceGroupName == null) |
| | 323 | | { |
| 0 | 324 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 325 | | } |
| 0 | 326 | | if (accountName == null) |
| | 327 | | { |
| 0 | 328 | | throw new ArgumentNullException(nameof(accountName)); |
| | 329 | | } |
| | 330 | |
|
| 0 | 331 | | using var message = CreateGetServicePropertiesRequest(resourceGroupName, accountName); |
| 0 | 332 | | _pipeline.Send(message, cancellationToken); |
| 0 | 333 | | switch (message.Response.Status) |
| | 334 | | { |
| | 335 | | case 200: |
| | 336 | | { |
| 0 | 337 | | QueueServiceProperties value = default; |
| 0 | 338 | | using var document = JsonDocument.Parse(message.Response.ContentStream); |
| 0 | 339 | | if (document.RootElement.ValueKind == JsonValueKind.Null) |
| | 340 | | { |
| 0 | 341 | | value = null; |
| | 342 | | } |
| | 343 | | else |
| | 344 | | { |
| 0 | 345 | | value = QueueServiceProperties.DeserializeQueueServiceProperties(document.RootElement); |
| | 346 | | } |
| 0 | 347 | | return Response.FromValue(value, message.Response); |
| | 348 | | } |
| | 349 | | default: |
| 0 | 350 | | throw _clientDiagnostics.CreateRequestFailedException(message.Response); |
| | 351 | | } |
| 0 | 352 | | } |
| | 353 | | } |
| | 354 | | } |