| | 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 Table service client. </summary> |
| | 19 | | public partial class TableOperations |
| | 20 | | { |
| | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | 22 | | private readonly HttpPipeline _pipeline; |
| 0 | 23 | | internal TableRestOperations RestClient { get; } |
| | 24 | | /// <summary> Initializes a new instance of TableOperations for mocking. </summary> |
| 0 | 25 | | protected TableOperations() |
| | 26 | | { |
| 0 | 27 | | } |
| | 28 | | /// <summary> Initializes a new instance of TableOperations. </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 TableOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri |
| | 35 | | { |
| 0 | 36 | | RestClient = new TableRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion); |
| 0 | 37 | | _clientDiagnostics = clientDiagnostics; |
| 0 | 38 | | _pipeline = pipeline; |
| 0 | 39 | | } |
| | 40 | |
|
| | 41 | | /// <summary> Creates a new table with the specified table 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="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 45 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 46 | | public virtual async Task<Response<Table>> CreateAsync(string resourceGroupName, string accountName, string tabl |
| | 47 | | { |
| 0 | 48 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Create"); |
| 0 | 49 | | scope.Start(); |
| | 50 | | try |
| | 51 | | { |
| 0 | 52 | | return await RestClient.CreateAsync(resourceGroupName, accountName, tableName, cancellationToken).Config |
| | 53 | | } |
| 0 | 54 | | catch (Exception e) |
| | 55 | | { |
| 0 | 56 | | scope.Failed(e); |
| 0 | 57 | | throw; |
| | 58 | | } |
| 0 | 59 | | } |
| | 60 | |
|
| | 61 | | /// <summary> Creates a new table with the specified table name, under the specified account. </summary> |
| | 62 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 63 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 64 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 65 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 66 | | public virtual Response<Table> Create(string resourceGroupName, string accountName, string tableName, Cancellati |
| | 67 | | { |
| 0 | 68 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Create"); |
| 0 | 69 | | scope.Start(); |
| | 70 | | try |
| | 71 | | { |
| 0 | 72 | | return RestClient.Create(resourceGroupName, accountName, tableName, cancellationToken); |
| | 73 | | } |
| 0 | 74 | | catch (Exception e) |
| | 75 | | { |
| 0 | 76 | | scope.Failed(e); |
| 0 | 77 | | throw; |
| | 78 | | } |
| 0 | 79 | | } |
| | 80 | |
|
| | 81 | | /// <summary> Creates a new table with the specified table name, under the specified account. </summary> |
| | 82 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 83 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 84 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 85 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 86 | | public virtual async Task<Response<Table>> UpdateAsync(string resourceGroupName, string accountName, string tabl |
| | 87 | | { |
| 0 | 88 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Update"); |
| 0 | 89 | | scope.Start(); |
| | 90 | | try |
| | 91 | | { |
| 0 | 92 | | return await RestClient.UpdateAsync(resourceGroupName, accountName, tableName, cancellationToken).Config |
| | 93 | | } |
| 0 | 94 | | catch (Exception e) |
| | 95 | | { |
| 0 | 96 | | scope.Failed(e); |
| 0 | 97 | | throw; |
| | 98 | | } |
| 0 | 99 | | } |
| | 100 | |
|
| | 101 | | /// <summary> Creates a new table with the specified table name, under the specified account. </summary> |
| | 102 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 103 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 104 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 105 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 106 | | public virtual Response<Table> Update(string resourceGroupName, string accountName, string tableName, Cancellati |
| | 107 | | { |
| 0 | 108 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Update"); |
| 0 | 109 | | scope.Start(); |
| | 110 | | try |
| | 111 | | { |
| 0 | 112 | | return RestClient.Update(resourceGroupName, accountName, tableName, cancellationToken); |
| | 113 | | } |
| 0 | 114 | | catch (Exception e) |
| | 115 | | { |
| 0 | 116 | | scope.Failed(e); |
| 0 | 117 | | throw; |
| | 118 | | } |
| 0 | 119 | | } |
| | 120 | |
|
| | 121 | | /// <summary> Gets the table with the specified table name, under the specified account if it exists. </summary> |
| | 122 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 123 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 124 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 125 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 126 | | public virtual async Task<Response<Table>> GetAsync(string resourceGroupName, string accountName, string tableNa |
| | 127 | | { |
| 0 | 128 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Get"); |
| 0 | 129 | | scope.Start(); |
| | 130 | | try |
| | 131 | | { |
| 0 | 132 | | return await RestClient.GetAsync(resourceGroupName, accountName, tableName, cancellationToken).Configure |
| | 133 | | } |
| 0 | 134 | | catch (Exception e) |
| | 135 | | { |
| 0 | 136 | | scope.Failed(e); |
| 0 | 137 | | throw; |
| | 138 | | } |
| 0 | 139 | | } |
| | 140 | |
|
| | 141 | | /// <summary> Gets the table with the specified table name, under the specified account if it exists. </summary> |
| | 142 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 143 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 144 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 145 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 146 | | public virtual Response<Table> Get(string resourceGroupName, string accountName, string tableName, CancellationT |
| | 147 | | { |
| 0 | 148 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Get"); |
| 0 | 149 | | scope.Start(); |
| | 150 | | try |
| | 151 | | { |
| 0 | 152 | | return RestClient.Get(resourceGroupName, accountName, tableName, cancellationToken); |
| | 153 | | } |
| 0 | 154 | | catch (Exception e) |
| | 155 | | { |
| 0 | 156 | | scope.Failed(e); |
| 0 | 157 | | throw; |
| | 158 | | } |
| 0 | 159 | | } |
| | 160 | |
|
| | 161 | | /// <summary> Deletes the table with the specified table name, under the specified account if it exists. </summa |
| | 162 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 163 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 164 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 165 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 166 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, string tableName, |
| | 167 | | { |
| 0 | 168 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Delete"); |
| 0 | 169 | | scope.Start(); |
| | 170 | | try |
| | 171 | | { |
| 0 | 172 | | return await RestClient.DeleteAsync(resourceGroupName, accountName, tableName, cancellationToken).Config |
| | 173 | | } |
| 0 | 174 | | catch (Exception e) |
| | 175 | | { |
| 0 | 176 | | scope.Failed(e); |
| 0 | 177 | | throw; |
| | 178 | | } |
| 0 | 179 | | } |
| | 180 | |
|
| | 181 | | /// <summary> Deletes the table with the specified table name, under the specified account if it exists. </summa |
| | 182 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 183 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 184 | | /// <param name="tableName"> A table name must be unique within a storage account and must be between 3 and 63 c |
| | 185 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 186 | | public virtual Response Delete(string resourceGroupName, string accountName, string tableName, CancellationToken |
| | 187 | | { |
| 0 | 188 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.Delete"); |
| 0 | 189 | | scope.Start(); |
| | 190 | | try |
| | 191 | | { |
| 0 | 192 | | return RestClient.Delete(resourceGroupName, accountName, tableName, cancellationToken); |
| | 193 | | } |
| 0 | 194 | | catch (Exception e) |
| | 195 | | { |
| 0 | 196 | | scope.Failed(e); |
| 0 | 197 | | throw; |
| | 198 | | } |
| 0 | 199 | | } |
| | 200 | |
|
| | 201 | | /// <summary> Gets a list of all the tables under the specified storage account. </summary> |
| | 202 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 203 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 204 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 205 | | public virtual AsyncPageable<Table> ListAsync(string resourceGroupName, string accountName, CancellationToken ca |
| | 206 | | { |
| 0 | 207 | | if (resourceGroupName == null) |
| | 208 | | { |
| 0 | 209 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 210 | | } |
| 0 | 211 | | if (accountName == null) |
| | 212 | | { |
| 0 | 213 | | throw new ArgumentNullException(nameof(accountName)); |
| | 214 | | } |
| | 215 | |
|
| | 216 | | async Task<Page<Table>> FirstPageFunc(int? pageSizeHint) |
| | 217 | | { |
| 0 | 218 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.List"); |
| 0 | 219 | | scope.Start(); |
| | 220 | | try |
| | 221 | | { |
| 0 | 222 | | var response = await RestClient.ListAsync(resourceGroupName, accountName, cancellationToken).Configu |
| 0 | 223 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 224 | | } |
| 0 | 225 | | catch (Exception e) |
| | 226 | | { |
| 0 | 227 | | scope.Failed(e); |
| 0 | 228 | | throw; |
| | 229 | | } |
| 0 | 230 | | } |
| | 231 | | async Task<Page<Table>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 232 | | { |
| 0 | 233 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.List"); |
| 0 | 234 | | scope.Start(); |
| | 235 | | try |
| | 236 | | { |
| 0 | 237 | | var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, accountName, cancella |
| 0 | 238 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 239 | | } |
| 0 | 240 | | catch (Exception e) |
| | 241 | | { |
| 0 | 242 | | scope.Failed(e); |
| 0 | 243 | | throw; |
| | 244 | | } |
| 0 | 245 | | } |
| 0 | 246 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | 247 | | } |
| | 248 | |
|
| | 249 | | /// <summary> Gets a list of all the tables under the specified storage account. </summary> |
| | 250 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | 251 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | 252 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | 253 | | public virtual Pageable<Table> List(string resourceGroupName, string accountName, CancellationToken cancellation |
| | 254 | | { |
| 0 | 255 | | if (resourceGroupName == null) |
| | 256 | | { |
| 0 | 257 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | 258 | | } |
| 0 | 259 | | if (accountName == null) |
| | 260 | | { |
| 0 | 261 | | throw new ArgumentNullException(nameof(accountName)); |
| | 262 | | } |
| | 263 | |
|
| | 264 | | Page<Table> FirstPageFunc(int? pageSizeHint) |
| | 265 | | { |
| 0 | 266 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.List"); |
| 0 | 267 | | scope.Start(); |
| | 268 | | try |
| | 269 | | { |
| 0 | 270 | | var response = RestClient.List(resourceGroupName, accountName, cancellationToken); |
| 0 | 271 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 272 | | } |
| 0 | 273 | | catch (Exception e) |
| | 274 | | { |
| 0 | 275 | | scope.Failed(e); |
| 0 | 276 | | throw; |
| | 277 | | } |
| 0 | 278 | | } |
| | 279 | | Page<Table> NextPageFunc(string nextLink, int? pageSizeHint) |
| | 280 | | { |
| 0 | 281 | | using var scope = _clientDiagnostics.CreateScope("TableOperations.List"); |
| 0 | 282 | | scope.Start(); |
| | 283 | | try |
| | 284 | | { |
| 0 | 285 | | var response = RestClient.ListNextPage(nextLink, resourceGroupName, accountName, cancellationToken); |
| 0 | 286 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | 287 | | } |
| 0 | 288 | | catch (Exception e) |
| | 289 | | { |
| 0 | 290 | | scope.Failed(e); |
| 0 | 291 | | throw; |
| | 292 | | } |
| 0 | 293 | | } |
| 0 | 294 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | 295 | | } |
| | 296 | | } |
| | 297 | | } |