| | | 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 StorageAccounts service client. </summary> |
| | | 19 | | public partial class StorageAccountsOperations |
| | | 20 | | { |
| | | 21 | | private readonly ClientDiagnostics _clientDiagnostics; |
| | | 22 | | private readonly HttpPipeline _pipeline; |
| | 844 | 23 | | internal StorageAccountsRestOperations RestClient { get; } |
| | | 24 | | /// <summary> Initializes a new instance of StorageAccountsOperations for mocking. </summary> |
| | 240 | 25 | | protected StorageAccountsOperations() |
| | | 26 | | { |
| | 240 | 27 | | } |
| | | 28 | | /// <summary> Initializes a new instance of StorageAccountsOperations. </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> |
| | 240 | 34 | | internal StorageAccountsOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscripti |
| | | 35 | | { |
| | 240 | 36 | | RestClient = new StorageAccountsRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVer |
| | 240 | 37 | | _clientDiagnostics = clientDiagnostics; |
| | 240 | 38 | | _pipeline = pipeline; |
| | 240 | 39 | | } |
| | | 40 | | |
| | | 41 | | /// <summary> Checks that the storage account name is valid and is not already in use. </summary> |
| | | 42 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 43 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 44 | | public virtual async Task<Response<CheckNameAvailabilityResult>> CheckNameAvailabilityAsync(StorageAccountCheckN |
| | | 45 | | { |
| | 6 | 46 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.CheckNameAvailability"); |
| | 6 | 47 | | scope.Start(); |
| | | 48 | | try |
| | | 49 | | { |
| | 6 | 50 | | return await RestClient.CheckNameAvailabilityAsync(accountName, cancellationToken).ConfigureAwait(false) |
| | | 51 | | } |
| | 0 | 52 | | catch (Exception e) |
| | | 53 | | { |
| | 0 | 54 | | scope.Failed(e); |
| | 0 | 55 | | throw; |
| | | 56 | | } |
| | 6 | 57 | | } |
| | | 58 | | |
| | | 59 | | /// <summary> Checks that the storage account name is valid and is not already in use. </summary> |
| | | 60 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 61 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 62 | | public virtual Response<CheckNameAvailabilityResult> CheckNameAvailability(StorageAccountCheckNameAvailabilityPa |
| | | 63 | | { |
| | 6 | 64 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.CheckNameAvailability"); |
| | 6 | 65 | | scope.Start(); |
| | | 66 | | try |
| | | 67 | | { |
| | 6 | 68 | | return RestClient.CheckNameAvailability(accountName, cancellationToken); |
| | | 69 | | } |
| | 0 | 70 | | catch (Exception e) |
| | | 71 | | { |
| | 0 | 72 | | scope.Failed(e); |
| | 0 | 73 | | throw; |
| | | 74 | | } |
| | 6 | 75 | | } |
| | | 76 | | |
| | | 77 | | /// <summary> Deletes a storage account in Microsoft Azure. </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="cancellationToken"> The cancellation token to use. </param> |
| | | 81 | | public virtual async Task<Response> DeleteAsync(string resourceGroupName, string accountName, CancellationToken |
| | | 82 | | { |
| | 6 | 83 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.Delete"); |
| | 6 | 84 | | scope.Start(); |
| | | 85 | | try |
| | | 86 | | { |
| | 6 | 87 | | return await RestClient.DeleteAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait(fa |
| | | 88 | | } |
| | 0 | 89 | | catch (Exception e) |
| | | 90 | | { |
| | 0 | 91 | | scope.Failed(e); |
| | 0 | 92 | | throw; |
| | | 93 | | } |
| | 6 | 94 | | } |
| | | 95 | | |
| | | 96 | | /// <summary> Deletes a storage account in Microsoft Azure. </summary> |
| | | 97 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 98 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 99 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 100 | | public virtual Response Delete(string resourceGroupName, string accountName, CancellationToken cancellationToken |
| | | 101 | | { |
| | 6 | 102 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.Delete"); |
| | 6 | 103 | | scope.Start(); |
| | | 104 | | try |
| | | 105 | | { |
| | 6 | 106 | | return RestClient.Delete(resourceGroupName, accountName, cancellationToken); |
| | | 107 | | } |
| | 0 | 108 | | catch (Exception e) |
| | | 109 | | { |
| | 0 | 110 | | scope.Failed(e); |
| | 0 | 111 | | throw; |
| | | 112 | | } |
| | 6 | 113 | | } |
| | | 114 | | |
| | | 115 | | /// <summary> Returns the properties for the specified storage account including but not limited to name, SKU na |
| | | 116 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 117 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 118 | | /// <param name="expand"> May be used to expand the properties within account's properties. By default, dat |
| | | 119 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 120 | | public virtual async Task<Response<StorageAccount>> GetPropertiesAsync(string resourceGroupName, string accountN |
| | | 121 | | { |
| | 58 | 122 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.GetProperties"); |
| | 58 | 123 | | scope.Start(); |
| | | 124 | | try |
| | | 125 | | { |
| | 58 | 126 | | return await RestClient.GetPropertiesAsync(resourceGroupName, accountName, expand, cancellationToken).Co |
| | | 127 | | } |
| | 0 | 128 | | catch (Exception e) |
| | | 129 | | { |
| | 0 | 130 | | scope.Failed(e); |
| | 0 | 131 | | throw; |
| | | 132 | | } |
| | 58 | 133 | | } |
| | | 134 | | |
| | | 135 | | /// <summary> Returns the properties for the specified storage account including but not limited to name, SKU na |
| | | 136 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 137 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 138 | | /// <param name="expand"> May be used to expand the properties within account's properties. By default, dat |
| | | 139 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 140 | | public virtual Response<StorageAccount> GetProperties(string resourceGroupName, string accountName, StorageAccou |
| | | 141 | | { |
| | 58 | 142 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.GetProperties"); |
| | 58 | 143 | | scope.Start(); |
| | | 144 | | try |
| | | 145 | | { |
| | 58 | 146 | | return RestClient.GetProperties(resourceGroupName, accountName, expand, cancellationToken); |
| | | 147 | | } |
| | 0 | 148 | | catch (Exception e) |
| | | 149 | | { |
| | 0 | 150 | | scope.Failed(e); |
| | 0 | 151 | | throw; |
| | | 152 | | } |
| | 58 | 153 | | } |
| | | 154 | | |
| | | 155 | | /// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage |
| | | 156 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 157 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 158 | | /// <param name="parameters"> The parameters to provide for the updated account. </param> |
| | | 159 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 160 | | public virtual async Task<Response<StorageAccount>> UpdateAsync(string resourceGroupName, string accountName, St |
| | | 161 | | { |
| | 30 | 162 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.Update"); |
| | 30 | 163 | | scope.Start(); |
| | | 164 | | try |
| | | 165 | | { |
| | 30 | 166 | | return await RestClient.UpdateAsync(resourceGroupName, accountName, parameters, cancellationToken).Confi |
| | | 167 | | } |
| | 2 | 168 | | catch (Exception e) |
| | | 169 | | { |
| | 2 | 170 | | scope.Failed(e); |
| | 2 | 171 | | throw; |
| | | 172 | | } |
| | 28 | 173 | | } |
| | | 174 | | |
| | | 175 | | /// <summary> The update operation can be used to update the SKU, encryption, access tier, or tags for a storage |
| | | 176 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 177 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 178 | | /// <param name="parameters"> The parameters to provide for the updated account. </param> |
| | | 179 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 180 | | public virtual Response<StorageAccount> Update(string resourceGroupName, string accountName, StorageAccountUpdat |
| | | 181 | | { |
| | 30 | 182 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.Update"); |
| | 30 | 183 | | scope.Start(); |
| | | 184 | | try |
| | | 185 | | { |
| | 30 | 186 | | return RestClient.Update(resourceGroupName, accountName, parameters, cancellationToken); |
| | | 187 | | } |
| | 2 | 188 | | catch (Exception e) |
| | | 189 | | { |
| | 2 | 190 | | scope.Failed(e); |
| | 2 | 191 | | throw; |
| | | 192 | | } |
| | 28 | 193 | | } |
| | | 194 | | |
| | | 195 | | /// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage acc |
| | | 196 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 197 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 198 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 199 | | public virtual async Task<Response<StorageAccountListKeysResult>> ListKeysAsync(string resourceGroupName, string |
| | | 200 | | { |
| | 4 | 201 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListKeys"); |
| | 4 | 202 | | scope.Start(); |
| | | 203 | | try |
| | | 204 | | { |
| | 4 | 205 | | return await RestClient.ListKeysAsync(resourceGroupName, accountName, cancellationToken).ConfigureAwait( |
| | | 206 | | } |
| | 0 | 207 | | catch (Exception e) |
| | | 208 | | { |
| | 0 | 209 | | scope.Failed(e); |
| | 0 | 210 | | throw; |
| | | 211 | | } |
| | 4 | 212 | | } |
| | | 213 | | |
| | | 214 | | /// <summary> Lists the access keys or Kerberos keys (if active directory enabled) for the specified storage acc |
| | | 215 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 216 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 217 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 218 | | public virtual Response<StorageAccountListKeysResult> ListKeys(string resourceGroupName, string accountName, Can |
| | | 219 | | { |
| | 4 | 220 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListKeys"); |
| | 4 | 221 | | scope.Start(); |
| | | 222 | | try |
| | | 223 | | { |
| | 4 | 224 | | return RestClient.ListKeys(resourceGroupName, accountName, cancellationToken); |
| | | 225 | | } |
| | 0 | 226 | | catch (Exception e) |
| | | 227 | | { |
| | 0 | 228 | | scope.Failed(e); |
| | 0 | 229 | | throw; |
| | | 230 | | } |
| | 4 | 231 | | } |
| | | 232 | | |
| | | 233 | | /// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary> |
| | | 234 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 235 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 236 | | /// <param name="regenerateKey"> Specifies name of the key which should be regenerated -- key1, key2, kerb1, ker |
| | | 237 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 238 | | public virtual async Task<Response<StorageAccountListKeysResult>> RegenerateKeyAsync(string resourceGroupName, s |
| | | 239 | | { |
| | 2 | 240 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.RegenerateKey"); |
| | 2 | 241 | | scope.Start(); |
| | | 242 | | try |
| | | 243 | | { |
| | 2 | 244 | | return await RestClient.RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey, cancellationTo |
| | | 245 | | } |
| | 0 | 246 | | catch (Exception e) |
| | | 247 | | { |
| | 0 | 248 | | scope.Failed(e); |
| | 0 | 249 | | throw; |
| | | 250 | | } |
| | 2 | 251 | | } |
| | | 252 | | |
| | | 253 | | /// <summary> Regenerates one of the access keys or Kerberos keys for the specified storage account. </summary> |
| | | 254 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 255 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 256 | | /// <param name="regenerateKey"> Specifies name of the key which should be regenerated -- key1, key2, kerb1, ker |
| | | 257 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 258 | | public virtual Response<StorageAccountListKeysResult> RegenerateKey(string resourceGroupName, string accountName |
| | | 259 | | { |
| | 2 | 260 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.RegenerateKey"); |
| | 2 | 261 | | scope.Start(); |
| | | 262 | | try |
| | | 263 | | { |
| | 2 | 264 | | return RestClient.RegenerateKey(resourceGroupName, accountName, regenerateKey, cancellationToken); |
| | | 265 | | } |
| | 0 | 266 | | catch (Exception e) |
| | | 267 | | { |
| | 0 | 268 | | scope.Failed(e); |
| | 0 | 269 | | throw; |
| | | 270 | | } |
| | 2 | 271 | | } |
| | | 272 | | |
| | | 273 | | /// <summary> List SAS credentials of a storage account. </summary> |
| | | 274 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 275 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 276 | | /// <param name="parameters"> The parameters to provide to list SAS credentials for the storage account. </param |
| | | 277 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 278 | | public virtual async Task<Response<ListAccountSasResponse>> ListAccountSASAsync(string resourceGroupName, string |
| | | 279 | | { |
| | 6 | 280 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListAccountSAS"); |
| | 6 | 281 | | scope.Start(); |
| | | 282 | | try |
| | | 283 | | { |
| | 6 | 284 | | return await RestClient.ListAccountSASAsync(resourceGroupName, accountName, parameters, cancellationToke |
| | | 285 | | } |
| | 2 | 286 | | catch (Exception e) |
| | | 287 | | { |
| | 2 | 288 | | scope.Failed(e); |
| | 2 | 289 | | throw; |
| | | 290 | | } |
| | 4 | 291 | | } |
| | | 292 | | |
| | | 293 | | /// <summary> List SAS credentials of a storage account. </summary> |
| | | 294 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 295 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 296 | | /// <param name="parameters"> The parameters to provide to list SAS credentials for the storage account. </param |
| | | 297 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 298 | | public virtual Response<ListAccountSasResponse> ListAccountSAS(string resourceGroupName, string accountName, Acc |
| | | 299 | | { |
| | 6 | 300 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListAccountSAS"); |
| | 6 | 301 | | scope.Start(); |
| | | 302 | | try |
| | | 303 | | { |
| | 6 | 304 | | return RestClient.ListAccountSAS(resourceGroupName, accountName, parameters, cancellationToken); |
| | | 305 | | } |
| | 2 | 306 | | catch (Exception e) |
| | | 307 | | { |
| | 2 | 308 | | scope.Failed(e); |
| | 2 | 309 | | throw; |
| | | 310 | | } |
| | 4 | 311 | | } |
| | | 312 | | |
| | | 313 | | /// <summary> List service SAS credentials of a specific resource. </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="parameters"> The parameters to provide to list service SAS credentials. </param> |
| | | 317 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 318 | | public virtual async Task<Response<ListServiceSasResponse>> ListServiceSASAsync(string resourceGroupName, string |
| | | 319 | | { |
| | 6 | 320 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListServiceSAS"); |
| | 6 | 321 | | scope.Start(); |
| | | 322 | | try |
| | | 323 | | { |
| | 6 | 324 | | return await RestClient.ListServiceSASAsync(resourceGroupName, accountName, parameters, cancellationToke |
| | | 325 | | } |
| | 2 | 326 | | catch (Exception e) |
| | | 327 | | { |
| | 2 | 328 | | scope.Failed(e); |
| | 2 | 329 | | throw; |
| | | 330 | | } |
| | 4 | 331 | | } |
| | | 332 | | |
| | | 333 | | /// <summary> List service SAS credentials of a specific resource. </summary> |
| | | 334 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 335 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 336 | | /// <param name="parameters"> The parameters to provide to list service SAS credentials. </param> |
| | | 337 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 338 | | public virtual Response<ListServiceSasResponse> ListServiceSAS(string resourceGroupName, string accountName, Ser |
| | | 339 | | { |
| | 6 | 340 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListServiceSAS"); |
| | 6 | 341 | | scope.Start(); |
| | | 342 | | try |
| | | 343 | | { |
| | 6 | 344 | | return RestClient.ListServiceSAS(resourceGroupName, accountName, parameters, cancellationToken); |
| | | 345 | | } |
| | 2 | 346 | | catch (Exception e) |
| | | 347 | | { |
| | 2 | 348 | | scope.Failed(e); |
| | 2 | 349 | | throw; |
| | | 350 | | } |
| | 4 | 351 | | } |
| | | 352 | | |
| | | 353 | | /// <summary> Revoke user delegation keys. </summary> |
| | | 354 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 355 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 356 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 357 | | public virtual async Task<Response> RevokeUserDelegationKeysAsync(string resourceGroupName, string accountName, |
| | | 358 | | { |
| | 2 | 359 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.RevokeUserDelegationKeys"); |
| | 2 | 360 | | scope.Start(); |
| | | 361 | | try |
| | | 362 | | { |
| | 2 | 363 | | return await RestClient.RevokeUserDelegationKeysAsync(resourceGroupName, accountName, cancellationToken) |
| | | 364 | | } |
| | 0 | 365 | | catch (Exception e) |
| | | 366 | | { |
| | 0 | 367 | | scope.Failed(e); |
| | 0 | 368 | | throw; |
| | | 369 | | } |
| | 2 | 370 | | } |
| | | 371 | | |
| | | 372 | | /// <summary> Revoke user delegation keys. </summary> |
| | | 373 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 374 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 375 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 376 | | public virtual Response RevokeUserDelegationKeys(string resourceGroupName, string accountName, CancellationToken |
| | | 377 | | { |
| | 2 | 378 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.RevokeUserDelegationKeys"); |
| | 2 | 379 | | scope.Start(); |
| | | 380 | | try |
| | | 381 | | { |
| | 2 | 382 | | return RestClient.RevokeUserDelegationKeys(resourceGroupName, accountName, cancellationToken); |
| | | 383 | | } |
| | 0 | 384 | | catch (Exception e) |
| | | 385 | | { |
| | 0 | 386 | | scope.Failed(e); |
| | 0 | 387 | | throw; |
| | | 388 | | } |
| | 2 | 389 | | } |
| | | 390 | | |
| | | 391 | | /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re |
| | | 392 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 393 | | public virtual AsyncPageable<StorageAccount> ListAsync(CancellationToken cancellationToken = default) |
| | | 394 | | { |
| | | 395 | | async Task<Page<StorageAccount>> FirstPageFunc(int? pageSizeHint) |
| | | 396 | | { |
| | 2 | 397 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.List"); |
| | 2 | 398 | | scope.Start(); |
| | | 399 | | try |
| | | 400 | | { |
| | 2 | 401 | | var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false); |
| | 2 | 402 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 403 | | } |
| | 0 | 404 | | catch (Exception e) |
| | | 405 | | { |
| | 0 | 406 | | scope.Failed(e); |
| | 0 | 407 | | throw; |
| | | 408 | | } |
| | 2 | 409 | | } |
| | | 410 | | async Task<Page<StorageAccount>> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 411 | | { |
| | 0 | 412 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.List"); |
| | 0 | 413 | | scope.Start(); |
| | | 414 | | try |
| | | 415 | | { |
| | 0 | 416 | | var response = await RestClient.ListNextPageAsync(nextLink, cancellationToken).ConfigureAwait(false) |
| | 0 | 417 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 418 | | } |
| | 0 | 419 | | catch (Exception e) |
| | | 420 | | { |
| | 0 | 421 | | scope.Failed(e); |
| | 0 | 422 | | throw; |
| | | 423 | | } |
| | 0 | 424 | | } |
| | 2 | 425 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); |
| | | 426 | | } |
| | | 427 | | |
| | | 428 | | /// <summary> Lists all the storage accounts available under the subscription. Note that storage keys are not re |
| | | 429 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 430 | | public virtual Pageable<StorageAccount> List(CancellationToken cancellationToken = default) |
| | | 431 | | { |
| | | 432 | | Page<StorageAccount> FirstPageFunc(int? pageSizeHint) |
| | | 433 | | { |
| | 2 | 434 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.List"); |
| | 2 | 435 | | scope.Start(); |
| | | 436 | | try |
| | | 437 | | { |
| | 2 | 438 | | var response = RestClient.List(cancellationToken); |
| | 2 | 439 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 440 | | } |
| | 0 | 441 | | catch (Exception e) |
| | | 442 | | { |
| | 0 | 443 | | scope.Failed(e); |
| | 0 | 444 | | throw; |
| | | 445 | | } |
| | 2 | 446 | | } |
| | | 447 | | Page<StorageAccount> NextPageFunc(string nextLink, int? pageSizeHint) |
| | | 448 | | { |
| | 0 | 449 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.List"); |
| | 0 | 450 | | scope.Start(); |
| | | 451 | | try |
| | | 452 | | { |
| | 0 | 453 | | var response = RestClient.ListNextPage(nextLink, cancellationToken); |
| | 0 | 454 | | return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); |
| | | 455 | | } |
| | 0 | 456 | | catch (Exception e) |
| | | 457 | | { |
| | 0 | 458 | | scope.Failed(e); |
| | 0 | 459 | | throw; |
| | | 460 | | } |
| | 0 | 461 | | } |
| | 2 | 462 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); |
| | | 463 | | } |
| | | 464 | | |
| | | 465 | | /// <summary> Lists all the storage accounts available under the given resource group. Note that storage keys ar |
| | | 466 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 467 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 468 | | public virtual AsyncPageable<StorageAccount> ListByResourceGroupAsync(string resourceGroupName, CancellationToke |
| | | 469 | | { |
| | 6 | 470 | | if (resourceGroupName == null) |
| | | 471 | | { |
| | 0 | 472 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 473 | | } |
| | | 474 | | |
| | | 475 | | async Task<Page<StorageAccount>> FirstPageFunc(int? pageSizeHint) |
| | | 476 | | { |
| | 6 | 477 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListByResourceGroup"); |
| | 6 | 478 | | scope.Start(); |
| | | 479 | | try |
| | | 480 | | { |
| | 6 | 481 | | var response = await RestClient.ListByResourceGroupAsync(resourceGroupName, cancellationToken).Confi |
| | 6 | 482 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | | 483 | | } |
| | 0 | 484 | | catch (Exception e) |
| | | 485 | | { |
| | 0 | 486 | | scope.Failed(e); |
| | 0 | 487 | | throw; |
| | | 488 | | } |
| | 6 | 489 | | } |
| | 6 | 490 | | return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); |
| | | 491 | | } |
| | | 492 | | |
| | | 493 | | /// <summary> Lists all the storage accounts available under the given resource group. Note that storage keys ar |
| | | 494 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 495 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 496 | | public virtual Pageable<StorageAccount> ListByResourceGroup(string resourceGroupName, CancellationToken cancella |
| | | 497 | | { |
| | 6 | 498 | | if (resourceGroupName == null) |
| | | 499 | | { |
| | 0 | 500 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 501 | | } |
| | | 502 | | |
| | | 503 | | Page<StorageAccount> FirstPageFunc(int? pageSizeHint) |
| | | 504 | | { |
| | 6 | 505 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.ListByResourceGroup"); |
| | 6 | 506 | | scope.Start(); |
| | | 507 | | try |
| | | 508 | | { |
| | 6 | 509 | | var response = RestClient.ListByResourceGroup(resourceGroupName, cancellationToken); |
| | 6 | 510 | | return Page.FromValues(response.Value.Value, null, response.GetRawResponse()); |
| | | 511 | | } |
| | 0 | 512 | | catch (Exception e) |
| | | 513 | | { |
| | 0 | 514 | | scope.Failed(e); |
| | 0 | 515 | | throw; |
| | | 516 | | } |
| | 6 | 517 | | } |
| | 6 | 518 | | return PageableHelpers.CreateEnumerable(FirstPageFunc, null); |
| | | 519 | | } |
| | | 520 | | |
| | | 521 | | /// <summary> Asynchronously creates a new storage account with the specified parameters. If an account is alrea |
| | | 522 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 523 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 524 | | /// <param name="parameters"> The parameters to provide for the created account. </param> |
| | | 525 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 526 | | public virtual async Task<StorageAccountsCreateOperation> StartCreateAsync(string resourceGroupName, string acco |
| | | 527 | | { |
| | 148 | 528 | | if (resourceGroupName == null) |
| | | 529 | | { |
| | 0 | 530 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 531 | | } |
| | 148 | 532 | | if (accountName == null) |
| | | 533 | | { |
| | 0 | 534 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 535 | | } |
| | 148 | 536 | | if (parameters == null) |
| | | 537 | | { |
| | 0 | 538 | | throw new ArgumentNullException(nameof(parameters)); |
| | | 539 | | } |
| | | 540 | | |
| | 148 | 541 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartCreate"); |
| | 148 | 542 | | scope.Start(); |
| | | 543 | | try |
| | | 544 | | { |
| | 148 | 545 | | var originalResponse = await RestClient.CreateAsync(resourceGroupName, accountName, parameters, cancella |
| | 146 | 546 | | return new StorageAccountsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest( |
| | | 547 | | } |
| | 2 | 548 | | catch (Exception e) |
| | | 549 | | { |
| | 2 | 550 | | scope.Failed(e); |
| | 2 | 551 | | throw; |
| | | 552 | | } |
| | 146 | 553 | | } |
| | | 554 | | |
| | | 555 | | /// <summary> Asynchronously creates a new storage account with the specified parameters. If an account is alrea |
| | | 556 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 557 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 558 | | /// <param name="parameters"> The parameters to provide for the created account. </param> |
| | | 559 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 560 | | public virtual StorageAccountsCreateOperation StartCreate(string resourceGroupName, string accountName, StorageA |
| | | 561 | | { |
| | 148 | 562 | | if (resourceGroupName == null) |
| | | 563 | | { |
| | 0 | 564 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 565 | | } |
| | 148 | 566 | | if (accountName == null) |
| | | 567 | | { |
| | 0 | 568 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 569 | | } |
| | 148 | 570 | | if (parameters == null) |
| | | 571 | | { |
| | 0 | 572 | | throw new ArgumentNullException(nameof(parameters)); |
| | | 573 | | } |
| | | 574 | | |
| | 148 | 575 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartCreate"); |
| | 148 | 576 | | scope.Start(); |
| | | 577 | | try |
| | | 578 | | { |
| | 148 | 579 | | var originalResponse = RestClient.Create(resourceGroupName, accountName, parameters, cancellationToken); |
| | 146 | 580 | | return new StorageAccountsCreateOperation(_clientDiagnostics, _pipeline, RestClient.CreateCreateRequest( |
| | | 581 | | } |
| | 2 | 582 | | catch (Exception e) |
| | | 583 | | { |
| | 2 | 584 | | scope.Failed(e); |
| | 2 | 585 | | throw; |
| | | 586 | | } |
| | 146 | 587 | | } |
| | | 588 | | |
| | | 589 | | /// <summary> Failover request can be triggered for a storage account in case of availability issues. The failov |
| | | 590 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 591 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 592 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 593 | | public virtual async Task<StorageAccountsFailoverOperation> StartFailoverAsync(string resourceGroupName, string |
| | | 594 | | { |
| | 0 | 595 | | if (resourceGroupName == null) |
| | | 596 | | { |
| | 0 | 597 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 598 | | } |
| | 0 | 599 | | if (accountName == null) |
| | | 600 | | { |
| | 0 | 601 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 602 | | } |
| | | 603 | | |
| | 0 | 604 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartFailover"); |
| | 0 | 605 | | scope.Start(); |
| | | 606 | | try |
| | | 607 | | { |
| | 0 | 608 | | var originalResponse = await RestClient.FailoverAsync(resourceGroupName, accountName, cancellationToken) |
| | 0 | 609 | | return new StorageAccountsFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequ |
| | | 610 | | } |
| | 0 | 611 | | catch (Exception e) |
| | | 612 | | { |
| | 0 | 613 | | scope.Failed(e); |
| | 0 | 614 | | throw; |
| | | 615 | | } |
| | 0 | 616 | | } |
| | | 617 | | |
| | | 618 | | /// <summary> Failover request can be triggered for a storage account in case of availability issues. The failov |
| | | 619 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 620 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 621 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 622 | | public virtual StorageAccountsFailoverOperation StartFailover(string resourceGroupName, string accountName, Canc |
| | | 623 | | { |
| | 0 | 624 | | if (resourceGroupName == null) |
| | | 625 | | { |
| | 0 | 626 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 627 | | } |
| | 0 | 628 | | if (accountName == null) |
| | | 629 | | { |
| | 0 | 630 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 631 | | } |
| | | 632 | | |
| | 0 | 633 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartFailover"); |
| | 0 | 634 | | scope.Start(); |
| | | 635 | | try |
| | | 636 | | { |
| | 0 | 637 | | var originalResponse = RestClient.Failover(resourceGroupName, accountName, cancellationToken); |
| | 0 | 638 | | return new StorageAccountsFailoverOperation(_clientDiagnostics, _pipeline, RestClient.CreateFailoverRequ |
| | | 639 | | } |
| | 0 | 640 | | catch (Exception e) |
| | | 641 | | { |
| | 0 | 642 | | scope.Failed(e); |
| | 0 | 643 | | throw; |
| | | 644 | | } |
| | 0 | 645 | | } |
| | | 646 | | |
| | | 647 | | /// <summary> Restore blobs in the specified blob ranges. </summary> |
| | | 648 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 649 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 650 | | /// <param name="parameters"> The parameters to provide for restore blob ranges. </param> |
| | | 651 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 652 | | public virtual async Task<StorageAccountsRestoreBlobRangesOperation> StartRestoreBlobRangesAsync(string resource |
| | | 653 | | { |
| | 0 | 654 | | if (resourceGroupName == null) |
| | | 655 | | { |
| | 0 | 656 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 657 | | } |
| | 0 | 658 | | if (accountName == null) |
| | | 659 | | { |
| | 0 | 660 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 661 | | } |
| | 0 | 662 | | if (parameters == null) |
| | | 663 | | { |
| | 0 | 664 | | throw new ArgumentNullException(nameof(parameters)); |
| | | 665 | | } |
| | | 666 | | |
| | 0 | 667 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartRestoreBlobRanges"); |
| | 0 | 668 | | scope.Start(); |
| | | 669 | | try |
| | | 670 | | { |
| | 0 | 671 | | var originalResponse = await RestClient.RestoreBlobRangesAsync(resourceGroupName, accountName, parameter |
| | 0 | 672 | | return new StorageAccountsRestoreBlobRangesOperation(_clientDiagnostics, _pipeline, RestClient.CreateRes |
| | | 673 | | } |
| | 0 | 674 | | catch (Exception e) |
| | | 675 | | { |
| | 0 | 676 | | scope.Failed(e); |
| | 0 | 677 | | throw; |
| | | 678 | | } |
| | 0 | 679 | | } |
| | | 680 | | |
| | | 681 | | /// <summary> Restore blobs in the specified blob ranges. </summary> |
| | | 682 | | /// <param name="resourceGroupName"> The name of the resource group within the user's subscription. The nam |
| | | 683 | | /// <param name="accountName"> The name of the storage account within the specified resource group. Storage acco |
| | | 684 | | /// <param name="parameters"> The parameters to provide for restore blob ranges. </param> |
| | | 685 | | /// <param name="cancellationToken"> The cancellation token to use. </param> |
| | | 686 | | public virtual StorageAccountsRestoreBlobRangesOperation StartRestoreBlobRanges(string resourceGroupName, string |
| | | 687 | | { |
| | 0 | 688 | | if (resourceGroupName == null) |
| | | 689 | | { |
| | 0 | 690 | | throw new ArgumentNullException(nameof(resourceGroupName)); |
| | | 691 | | } |
| | 0 | 692 | | if (accountName == null) |
| | | 693 | | { |
| | 0 | 694 | | throw new ArgumentNullException(nameof(accountName)); |
| | | 695 | | } |
| | 0 | 696 | | if (parameters == null) |
| | | 697 | | { |
| | 0 | 698 | | throw new ArgumentNullException(nameof(parameters)); |
| | | 699 | | } |
| | | 700 | | |
| | 0 | 701 | | using var scope = _clientDiagnostics.CreateScope("StorageAccountsOperations.StartRestoreBlobRanges"); |
| | 0 | 702 | | scope.Start(); |
| | | 703 | | try |
| | | 704 | | { |
| | 0 | 705 | | var originalResponse = RestClient.RestoreBlobRanges(resourceGroupName, accountName, parameters, cancella |
| | 0 | 706 | | return new StorageAccountsRestoreBlobRangesOperation(_clientDiagnostics, _pipeline, RestClient.CreateRes |
| | | 707 | | } |
| | 0 | 708 | | catch (Exception e) |
| | | 709 | | { |
| | 0 | 710 | | scope.Failed(e); |
| | 0 | 711 | | throw; |
| | | 712 | | } |
| | 0 | 713 | | } |
| | | 714 | | } |
| | | 715 | | } |