Class: Azure::ARM::Storage::StorageAccounts

Inherits:
Object
  • Object
show all
Includes:
Models, MsRestAzure
Defined in:
lib/generated/azure_mgmt_storage/storage_accounts.rb

Overview

The Storage Management Client.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ StorageAccounts

Creates and initializes a new instance of the StorageAccounts class.

Parameters:

  • client

    service class for accessing basic functionality.



18
19
20
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 18

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientStorageManagementClient (readonly)

Returns reference to the StorageManagementClient.

Returns:



23
24
25
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 23

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ StorageAccount

Asynchronously creates a new storage account with the specified parameters. If an account is already created and subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and subsequent create or update request is issued with exact same set of properties, the request will succeed.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the created account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountCreateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



208
209
210
211
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 208

def begin_create(resource_group_name, , parameters, custom_headers = nil)
  response = begin_create_async(resource_group_name, , parameters, custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

Asynchronously creates a new storage account with the specified parameters. If an account is already created and subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and subsequent create or update request is issued with exact same set of properties, the request will succeed.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the created account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountCreateParameters)

    The parameters to provide

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 255

def begin_create_async(resource_group_name, , parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = StorageAccountCreateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 202 || status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccount.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Asynchronously creates a new storage account with the specified parameters. If an account is already created and subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and subsequent create or update request is issued with exact same set of properties, the request will succeed.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the created account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountCreateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



232
233
234
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 232

def begin_create_with_http_info(resource_group_name, , parameters, custom_headers = nil)
  begin_create_async(resource_group_name, , parameters, custom_headers).value!
end

#check_name_availability(account_name, custom_headers = nil) ⇒ CheckNameAvailabilityResult

Checks that account name is valid and is not in use.

of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

Returns:



37
38
39
40
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 37

def check_name_availability(, custom_headers = nil)
  response = check_name_availability_async(, custom_headers).value!
  response.body unless response.nil?
end

#check_name_availability_async(account_name, custom_headers = nil) ⇒ Concurrent::Promise

Checks that account name is valid and is not in use.

of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.

Parameters:

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 70

def check_name_availability_async(, custom_headers = nil)
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = StorageAccountCheckNameAvailabilityParameters.mapper()
  request_content = @client.serialize(request_mapper,  , 'account_name')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = CheckNameAvailabilityResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#check_name_availability_with_http_info(account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Checks that account name is valid and is not in use.

of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



54
55
56
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 54

def check_name_availability_with_http_info(, custom_headers = nil)
  check_name_availability_async(, custom_headers).value!
end

#create(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ StorageAccount

Asynchronously creates a new storage account with the specified parameters. If an account is already created and subsequent create request is issued with different properties, the account properties will be updated. If an account is already created and subsequent create or update request is issued with exact same set of properties, the request will succeed.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the created account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountCreateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



152
153
154
155
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 152

def create(resource_group_name, , parameters, custom_headers = nil)
  response = create_async(resource_group_name, , parameters, custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the created account. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountCreateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 171

def create_async(resource_group_name, , parameters, custom_headers = nil)
  # Send request
  promise = begin_create_async(resource_group_name, , parameters, custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = StorageAccount.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, account_name, custom_headers = nil) ⇒ Object

Deletes a storage account in Microsoft Azure.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



332
333
334
335
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 332

def delete(resource_group_name, , custom_headers = nil)
  response = delete_async(resource_group_name, , custom_headers).value!
  nil
end

#delete_async(resource_group_name, account_name, custom_headers = nil) ⇒ Concurrent::Promise

Deletes a storage account in Microsoft Azure.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 367

def delete_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(resource_group_name, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a storage account in Microsoft Azure.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



350
351
352
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 350

def delete_with_http_info(resource_group_name, , custom_headers = nil)
  delete_async(resource_group_name, , custom_headers).value!
end

#get_properties(resource_group_name, account_name, custom_headers = nil) ⇒ StorageAccount

Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



427
428
429
430
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 427

def get_properties(resource_group_name, , custom_headers = nil)
  response = get_properties_async(resource_group_name, , custom_headers).value!
  response.body unless response.nil?
end

#get_properties_async(resource_group_name, account_name, custom_headers = nil) ⇒ Concurrent::Promise

Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 466

def get_properties_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccount.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_properties_with_http_info(resource_group_name, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Returns the properties for the specified storage account including but not limited to name, account type, location, and account status. The ListKeys operation should be used to retrieve storage keys.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



447
448
449
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 447

def get_properties_with_http_info(resource_group_name, , custom_headers = nil)
  get_properties_async(resource_group_name, , custom_headers).value!
end

#list(custom_headers = nil) ⇒ StorageAccountListResult

Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



673
674
675
676
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 673

def list(custom_headers = nil)
  response = list_async(custom_headers).value!
  response.body unless response.nil?
end

#list_async(custom_headers = nil) ⇒ Concurrent::Promise

Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 700

def list_async(custom_headers = nil)
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group(resource_group_name, custom_headers = nil) ⇒ StorageAccountListResult

Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.

the user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



765
766
767
768
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 765

def list_by_resource_group(resource_group_name, custom_headers = nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_async(resource_group_name, custom_headers = nil) ⇒ Concurrent::Promise

Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.

the user’s subscription. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 798

def list_by_resource_group_async(resource_group_name, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccountListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the storage accounts available under the given resource group. Note that storage keys are not returned; use the ListKeys operation for this.

the user’s subscription. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



782
783
784
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 782

def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
  list_by_resource_group_async(resource_group_name, custom_headers).value!
end

#list_keys(resource_group_name, account_name, custom_headers = nil) ⇒ StorageAccountListKeysResult

Lists the access keys for the specified storage account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • account_name (String)

    The name of the storage account.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



862
863
864
865
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 862

def list_keys(resource_group_name, , custom_headers = nil)
  response = list_keys_async(resource_group_name, , custom_headers).value!
  response.body unless response.nil?
end

#list_keys_async(resource_group_name, account_name, custom_headers = nil) ⇒ Concurrent::Promise

Lists the access keys for the specified storage account.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • account_name (String)

    The name of the storage account.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 891

def list_keys_async(resource_group_name, , custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccountListKeysResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_keys_with_http_info(resource_group_name, account_name, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the access keys for the specified storage account.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • account_name (String)

    The name of the storage account.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



877
878
879
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 877

def list_keys_with_http_info(resource_group_name, , custom_headers = nil)
  list_keys_async(resource_group_name, , custom_headers).value!
end

#list_with_http_info(custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Lists all the storage accounts available under the subscription. Note that storage keys are not returned; use the ListKeys operation for this.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



687
688
689
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 687

def list_with_http_info(custom_headers = nil)
  list_async(custom_headers).value!
end

#regenerate_key(resource_group_name, account_name, regenerate_key, custom_headers = nil) ⇒ StorageAccountListKeysResult

Regenerates the access keys for the specified storage account.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. of the key which should be regenerated. key1 or key2 for the default keys will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • regenerate_key (StorageAccountRegenerateKeyParameters)

    Specifies name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



961
962
963
964
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 961

def regenerate_key(resource_group_name, , regenerate_key, custom_headers = nil)
  response = regenerate_key_async(resource_group_name, , regenerate_key, custom_headers).value!
  response.body unless response.nil?
end

#regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers = nil) ⇒ Concurrent::Promise

Regenerates the access keys for the specified storage account.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. of the key which should be regenerated. key1 or key2 for the default keys to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • regenerate_key (StorageAccountRegenerateKeyParameters)

    Specifies name

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 1000

def regenerate_key_async(resource_group_name, , regenerate_key, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, 'regenerate_key is nil' if regenerate_key.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = StorageAccountRegenerateKeyParameters.mapper()
  request_content = @client.serialize(request_mapper,  regenerate_key, 'regenerate_key')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccountListKeysResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#regenerate_key_with_http_info(resource_group_name, account_name, regenerate_key, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

Regenerates the access keys for the specified storage account.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. of the key which should be regenerated. key1 or key2 for the default keys will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • regenerate_key (StorageAccountRegenerateKeyParameters)

    Specifies name

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



981
982
983
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 981

def regenerate_key_with_http_info(resource_group_name, , regenerate_key, custom_headers = nil)
  regenerate_key_async(resource_group_name, , regenerate_key, custom_headers).value!
end

#update(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ StorageAccount

The update operation can be used to update the account type, encryption, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account and. replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value may be set. Update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the updated account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountUpdateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:



544
545
546
547
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 544

def update(resource_group_name, , parameters, custom_headers = nil)
  response = update_async(resource_group_name, , parameters, custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ Concurrent::Promise

The update operation can be used to update the account type, encryption, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account and. replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value may be set. Update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the updated account. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountUpdateParameters)

    The parameters to provide

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 599

def update_async(resource_group_name, , parameters, custom_headers = nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'account_name is nil' if .nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Serialize Request
  request_mapper = StorageAccountUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters, 'parameters')
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'accountName' => ,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {})
  }

  request_url = @base_url || @client.base_url

  request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
  promise = request.run_promise do |req|
    @client.credentials.sign_request(req) unless @client.credentials.nil?
  end

  promise = promise.then do |http_response|
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
    end

    # Create Result
    result = MsRestAzure::AzureOperationResponse.new(request, http_response)
    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = StorageAccount.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#update_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil) ⇒ MsRestAzure::AzureOperationResponse

The update operation can be used to update the account type, encryption, or tags for a storage account. It can also be used to map the account to a custom domain. Only one custom domain is supported per storage account and. replacement/change of custom domain is not supported. In order to replace an old custom domain, the old value must be cleared/unregistered before a new value may be set. Update of multiple properties is supported. This call does not change the storage keys for the account. If you want to change storage account keys, use the regenerate keys operation. The location and name of the storage account cannot be changed after creation.

the user’s subscription. specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. for the updated account. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group within

  • account_name (String)

    The name of the storage account within the

  • parameters (StorageAccountUpdateParameters)

    The parameters to provide

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



572
573
574
# File 'lib/generated/azure_mgmt_storage/storage_accounts.rb', line 572

def update_with_http_info(resource_group_name, , parameters, custom_headers = nil)
  update_async(resource_group_name, , parameters, custom_headers).value!
end