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