azure_mgmt_storage 0.17.8 → 0.17.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +5 -5
  2. data/lib/2015-05-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  3. data/lib/2015-06-15/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  4. data/lib/2016-01-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  5. data/lib/2016-12-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  6. data/lib/2017-06-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  7. data/lib/2017-10-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  8. data/lib/2018-02-01/generated/azure_mgmt_storage.rb +25 -23
  9. data/lib/2018-02-01/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  10. data/lib/2018-02-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  11. data/lib/2018-02-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  12. data/lib/2018-02-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  13. data/lib/2018-03-01-preview/generated/azure_mgmt_storage.rb +24 -22
  14. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  15. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  16. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  17. data/lib/2018-03-01-preview/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  18. data/lib/2018-07-01/generated/azure_mgmt_storage.rb +27 -25
  19. data/lib/2018-07-01/generated/azure_mgmt_storage/blob_containers.rb +142 -0
  20. data/lib/2018-07-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  21. data/lib/2018-07-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  22. data/lib/2018-07-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  23. data/lib/2018-11-01/generated/azure_mgmt_storage.rb +31 -29
  24. data/lib/2018-11-01/generated/azure_mgmt_storage/blob_containers.rb +153 -1
  25. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  26. data/lib/2018-11-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  27. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_accounts.rb +97 -0
  28. data/lib/2018-11-01/generated/azure_mgmt_storage/storage_management_client.rb +1 -1
  29. data/lib/2019-04-01/generated/azure_mgmt_storage.rb +128 -0
  30. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_containers.rb +1873 -0
  31. data/lib/2019-04-01/generated/azure_mgmt_storage/blob_services.rb +266 -0
  32. data/lib/2019-04-01/generated/azure_mgmt_storage/management_policies.rb +355 -0
  33. data/lib/2019-04-01/generated/azure_mgmt_storage/models/access_tier.rb +16 -0
  34. data/lib/2019-04-01/generated/azure_mgmt_storage/models/account_sas_parameters.rb +136 -0
  35. data/lib/2019-04-01/generated/azure_mgmt_storage/models/account_status.rb +16 -0
  36. data/lib/2019-04-01/generated/azure_mgmt_storage/models/action.rb +15 -0
  37. data/lib/2019-04-01/generated/azure_mgmt_storage/models/azure_entity_resource.rb +75 -0
  38. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_container.rb +217 -0
  39. data/lib/2019-04-01/generated/azure_mgmt_storage/models/blob_service_properties.rb +115 -0
  40. data/lib/2019-04-01/generated/azure_mgmt_storage/models/bypass.rb +18 -0
  41. data/lib/2019-04-01/generated/azure_mgmt_storage/models/check_name_availability_result.rb +77 -0
  42. data/lib/2019-04-01/generated/azure_mgmt_storage/models/cors_rule.rb +128 -0
  43. data/lib/2019-04-01/generated/azure_mgmt_storage/models/cors_rules.rb +57 -0
  44. data/lib/2019-04-01/generated/azure_mgmt_storage/models/custom_domain.rb +60 -0
  45. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_creation.rb +50 -0
  46. data/lib/2019-04-01/generated/azure_mgmt_storage/models/date_after_modification.rb +50 -0
  47. data/lib/2019-04-01/generated/azure_mgmt_storage/models/default_action.rb +16 -0
  48. data/lib/2019-04-01/generated/azure_mgmt_storage/models/delete_retention_policy.rb +64 -0
  49. data/lib/2019-04-01/generated/azure_mgmt_storage/models/dimension.rb +57 -0
  50. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption.rb +74 -0
  51. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption_service.rb +62 -0
  52. data/lib/2019-04-01/generated/azure_mgmt_storage/models/encryption_services.rb +89 -0
  53. data/lib/2019-04-01/generated/azure_mgmt_storage/models/endpoints.rb +108 -0
  54. data/lib/2019-04-01/generated/azure_mgmt_storage/models/geo_replication_stats.rb +85 -0
  55. data/lib/2019-04-01/generated/azure_mgmt_storage/models/geo_replication_status.rb +17 -0
  56. data/lib/2019-04-01/generated/azure_mgmt_storage/models/http_protocol.rb +16 -0
  57. data/lib/2019-04-01/generated/azure_mgmt_storage/models/identity.rb +72 -0
  58. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy.rb +98 -0
  59. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_properties.rb +95 -0
  60. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_state.rb +16 -0
  61. data/lib/2019-04-01/generated/azure_mgmt_storage/models/immutability_policy_update_type.rb +17 -0
  62. data/lib/2019-04-01/generated/azure_mgmt_storage/models/iprule.rb +61 -0
  63. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_permission.rb +16 -0
  64. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_source.rb +16 -0
  65. data/lib/2019-04-01/generated/azure_mgmt_storage/models/key_vault_properties.rb +68 -0
  66. data/lib/2019-04-01/generated/azure_mgmt_storage/models/kind.rb +19 -0
  67. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_container_request.rb +97 -0
  68. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_container_response.rb +60 -0
  69. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_duration.rb +16 -0
  70. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_state.rb +19 -0
  71. data/lib/2019-04-01/generated/azure_mgmt_storage/models/lease_status.rb +16 -0
  72. data/lib/2019-04-01/generated/azure_mgmt_storage/models/legal_hold.rb +71 -0
  73. data/lib/2019-04-01/generated/azure_mgmt_storage/models/legal_hold_properties.rb +72 -0
  74. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_account_sas_response.rb +47 -0
  75. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_container_item.rb +216 -0
  76. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_container_items.rb +55 -0
  77. data/lib/2019-04-01/generated/azure_mgmt_storage/models/list_service_sas_response.rb +47 -0
  78. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy.rb +89 -0
  79. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_action.rb +62 -0
  80. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_base_blob.rb +73 -0
  81. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_definition.rb +60 -0
  82. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_filter.rb +76 -0
  83. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_rule.rb +87 -0
  84. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_schema.rb +58 -0
  85. data/lib/2019-04-01/generated/azure_mgmt_storage/models/management_policy_snap_shot.rb +47 -0
  86. data/lib/2019-04-01/generated/azure_mgmt_storage/models/metric_specification.rb +145 -0
  87. data/lib/2019-04-01/generated/azure_mgmt_storage/models/network_rule_set.rb +106 -0
  88. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation.rb +83 -0
  89. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation_display.rb +79 -0
  90. data/lib/2019-04-01/generated/azure_mgmt_storage/models/operation_list_result.rb +57 -0
  91. data/lib/2019-04-01/generated/azure_mgmt_storage/models/permissions.rb +22 -0
  92. data/lib/2019-04-01/generated/azure_mgmt_storage/models/provisioning_state.rb +17 -0
  93. data/lib/2019-04-01/generated/azure_mgmt_storage/models/proxy_resource.rb +63 -0
  94. data/lib/2019-04-01/generated/azure_mgmt_storage/models/public_access.rb +17 -0
  95. data/lib/2019-04-01/generated/azure_mgmt_storage/models/reason.rb +16 -0
  96. data/lib/2019-04-01/generated/azure_mgmt_storage/models/reason_code.rb +16 -0
  97. data/lib/2019-04-01/generated/azure_mgmt_storage/models/resource.rb +83 -0
  98. data/lib/2019-04-01/generated/azure_mgmt_storage/models/restriction.rb +85 -0
  99. data/lib/2019-04-01/generated/azure_mgmt_storage/models/service_sas_parameters.rb +247 -0
  100. data/lib/2019-04-01/generated/azure_mgmt_storage/models/service_specification.rb +56 -0
  101. data/lib/2019-04-01/generated/azure_mgmt_storage/models/services.rb +18 -0
  102. data/lib/2019-04-01/generated/azure_mgmt_storage/models/signed_resource.rb +18 -0
  103. data/lib/2019-04-01/generated/azure_mgmt_storage/models/signed_resource_types.rb +17 -0
  104. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku.rb +157 -0
  105. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku_name.rb +22 -0
  106. data/lib/2019-04-01/generated/azure_mgmt_storage/models/sku_tier.rb +16 -0
  107. data/lib/2019-04-01/generated/azure_mgmt_storage/models/skucapability.rb +63 -0
  108. data/lib/2019-04-01/generated/azure_mgmt_storage/models/state.rb +19 -0
  109. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account.rb +374 -0
  110. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +63 -0
  111. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_create_parameters.rb +202 -0
  112. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_expand.rb +15 -0
  113. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_key.rb +73 -0
  114. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_keys_result.rb +57 -0
  115. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_list_result.rb +57 -0
  116. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +47 -0
  117. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_account_update_parameters.rb +178 -0
  118. data/lib/2019-04-01/generated/azure_mgmt_storage/models/storage_sku_list_result.rb +57 -0
  119. data/lib/2019-04-01/generated/azure_mgmt_storage/models/tag_property.rb +97 -0
  120. data/lib/2019-04-01/generated/azure_mgmt_storage/models/tracked_resource.rb +92 -0
  121. data/lib/2019-04-01/generated/azure_mgmt_storage/models/update_history_property.rb +114 -0
  122. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage.rb +89 -0
  123. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_list_result.rb +56 -0
  124. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_name.rb +59 -0
  125. data/lib/2019-04-01/generated/azure_mgmt_storage/models/usage_unit.rb +20 -0
  126. data/lib/2019-04-01/generated/azure_mgmt_storage/models/virtual_network_rule.rb +75 -0
  127. data/lib/2019-04-01/generated/azure_mgmt_storage/module_definition.rb +9 -0
  128. data/lib/2019-04-01/generated/azure_mgmt_storage/operations.rb +108 -0
  129. data/lib/2019-04-01/generated/azure_mgmt_storage/skus.rb +114 -0
  130. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_accounts.rb +1602 -0
  131. data/lib/2019-04-01/generated/azure_mgmt_storage/storage_management_client.rb +155 -0
  132. data/lib/2019-04-01/generated/azure_mgmt_storage/usages.rb +118 -0
  133. data/lib/azure_mgmt_storage.rb +1 -0
  134. data/lib/profiles/latest/modules/storage_profile_module.rb +232 -224
  135. data/lib/version.rb +1 -1
  136. metadata +115 -3
@@ -0,0 +1,114 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_04_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class Skus
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Skus class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists the available SKUs supported by Microsoft.Storage for given
26
+ # subscription.
27
+ #
28
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
29
+ # will be added to the HTTP request.
30
+ #
31
+ # @return [StorageSkuListResult] operation results.
32
+ #
33
+ def list(custom_headers:nil)
34
+ response = list_async(custom_headers:custom_headers).value!
35
+ response.body unless response.nil?
36
+ end
37
+
38
+ #
39
+ # Lists the available SKUs supported by Microsoft.Storage for given
40
+ # subscription.
41
+ #
42
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
43
+ # will be added to the HTTP request.
44
+ #
45
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
46
+ #
47
+ def list_with_http_info(custom_headers:nil)
48
+ list_async(custom_headers:custom_headers).value!
49
+ end
50
+
51
+ #
52
+ # Lists the available SKUs supported by Microsoft.Storage for given
53
+ # subscription.
54
+ #
55
+ # @param [Hash{String => String}] A hash of custom headers that will be added
56
+ # to the HTTP request.
57
+ #
58
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
59
+ #
60
+ def list_async(custom_headers:nil)
61
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
62
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
63
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
64
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
65
+
66
+
67
+ request_headers = {}
68
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
69
+
70
+ # Set Headers
71
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/skus'
74
+
75
+ request_url = @base_url || @client.base_url
76
+
77
+ options = {
78
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
79
+ path_params: {'subscriptionId' => @client.subscription_id},
80
+ query_params: {'api-version' => @client.api_version},
81
+ headers: request_headers.merge(custom_headers || {}),
82
+ base_url: request_url
83
+ }
84
+ promise = @client.make_request_async(:get, path_template, options)
85
+
86
+ promise = promise.then do |result|
87
+ http_response = result.response
88
+ status_code = http_response.status
89
+ response_content = http_response.body
90
+ unless status_code == 200
91
+ error_model = JSON.load(response_content)
92
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
93
+ end
94
+
95
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
96
+ # Deserialize Response
97
+ if status_code == 200
98
+ begin
99
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
100
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageSkuListResult.mapper()
101
+ result.body = @client.deserialize(result_mapper, parsed_response)
102
+ rescue Exception => e
103
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
104
+ end
105
+ end
106
+
107
+ result
108
+ end
109
+
110
+ promise.execute
111
+ end
112
+
113
+ end
114
+ end
@@ -0,0 +1,1602 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Storage::Mgmt::V2019_04_01
7
+ #
8
+ # The Azure Storage Management API.
9
+ #
10
+ class StorageAccounts
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the StorageAccounts class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [StorageManagementClient] reference to the StorageManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Checks that the storage account name is valid and is not already in use.
26
+ #
27
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
28
+ # of the storage account within the specified resource group. Storage account
29
+ # names must be between 3 and 24 characters in length and use numbers and
30
+ # lower-case letters only.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [CheckNameAvailabilityResult] operation results.
35
+ #
36
+ def check_name_availability(account_name, custom_headers:nil)
37
+ response = check_name_availability_async(account_name, custom_headers:custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Checks that the storage account name is valid and is not already in use.
43
+ #
44
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
45
+ # of the storage account within the specified resource group. Storage account
46
+ # names must be between 3 and 24 characters in length and use numbers and
47
+ # lower-case letters only.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
52
+ #
53
+ def check_name_availability_with_http_info(account_name, custom_headers:nil)
54
+ check_name_availability_async(account_name, custom_headers:custom_headers).value!
55
+ end
56
+
57
+ #
58
+ # Checks that the storage account name is valid and is not already in use.
59
+ #
60
+ # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
61
+ # of the storage account within the specified resource group. Storage account
62
+ # names must be between 3 and 24 characters in length and use numbers and
63
+ # lower-case letters only.
64
+ # @param [Hash{String => String}] A hash of custom headers that will be added
65
+ # to the HTTP request.
66
+ #
67
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
68
+ #
69
+ def check_name_availability_async(account_name, custom_headers:nil)
70
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
71
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
72
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
73
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
74
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
75
+
76
+
77
+ request_headers = {}
78
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
+
80
+ # Set Headers
81
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
82
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
83
+
84
+ # Serialize Request
85
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountCheckNameAvailabilityParameters.mapper()
86
+ request_content = @client.serialize(request_mapper, account_name)
87
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
88
+
89
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'subscriptionId' => @client.subscription_id},
96
+ query_params: {'api-version' => @client.api_version},
97
+ body: request_content,
98
+ headers: request_headers.merge(custom_headers || {}),
99
+ base_url: request_url
100
+ }
101
+ promise = @client.make_request_async(:post, path_template, options)
102
+
103
+ promise = promise.then do |result|
104
+ http_response = result.response
105
+ status_code = http_response.status
106
+ response_content = http_response.body
107
+ unless status_code == 200
108
+ error_model = JSON.load(response_content)
109
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
110
+ end
111
+
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::CheckNameAvailabilityResult.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response)
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+
127
+ promise.execute
128
+ end
129
+
130
+ #
131
+ # Asynchronously creates a new storage account with the specified parameters.
132
+ # If an account is already created and a subsequent create request is issued
133
+ # with different properties, the account properties will be updated. If an
134
+ # account is already created and a subsequent create or update request is
135
+ # issued with the exact same set of properties, the request will succeed.
136
+ #
137
+ # @param resource_group_name [String] The name of the resource group within the
138
+ # user's subscription. The name is case insensitive.
139
+ # @param account_name [String] The name of the storage account within the
140
+ # specified resource group. Storage account names must be between 3 and 24
141
+ # characters in length and use numbers and lower-case letters only.
142
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
143
+ # for the created account.
144
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
145
+ # will be added to the HTTP request.
146
+ #
147
+ # @return [StorageAccount] operation results.
148
+ #
149
+ def create(resource_group_name, account_name, parameters, custom_headers:nil)
150
+ response = create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
151
+ response.body unless response.nil?
152
+ end
153
+
154
+ #
155
+ # @param resource_group_name [String] The name of the resource group within the
156
+ # user's subscription. The name is case insensitive.
157
+ # @param account_name [String] The name of the storage account within the
158
+ # specified resource group. Storage account names must be between 3 and 24
159
+ # characters in length and use numbers and lower-case letters only.
160
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
161
+ # for the created account.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [Concurrent::Promise] promise which provides async access to http
166
+ # response.
167
+ #
168
+ def create_async(resource_group_name, account_name, parameters, custom_headers:nil)
169
+ # Send request
170
+ promise = begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers)
171
+
172
+ promise = promise.then do |response|
173
+ # Defining deserialization method.
174
+ deserialize_method = lambda do |parsed_response|
175
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccount.mapper()
176
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
177
+ end
178
+
179
+ # Waiting for response.
180
+ @client.get_long_running_operation_result(response, deserialize_method)
181
+ end
182
+
183
+ promise
184
+ end
185
+
186
+ #
187
+ # Deletes a storage account in Microsoft Azure.
188
+ #
189
+ # @param resource_group_name [String] The name of the resource group within the
190
+ # user's subscription. The name is case insensitive.
191
+ # @param account_name [String] The name of the storage account within the
192
+ # specified resource group. Storage account names must be between 3 and 24
193
+ # characters in length and use numbers and lower-case letters only.
194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
195
+ # will be added to the HTTP request.
196
+ #
197
+ #
198
+ def delete(resource_group_name, account_name, custom_headers:nil)
199
+ response = delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
200
+ nil
201
+ end
202
+
203
+ #
204
+ # Deletes a storage account in Microsoft Azure.
205
+ #
206
+ # @param resource_group_name [String] The name of the resource group within the
207
+ # user's subscription. The name is case insensitive.
208
+ # @param account_name [String] The name of the storage account within the
209
+ # specified resource group. Storage account names must be between 3 and 24
210
+ # characters in length and use numbers and lower-case letters only.
211
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
212
+ # will be added to the HTTP request.
213
+ #
214
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
215
+ #
216
+ def delete_with_http_info(resource_group_name, account_name, custom_headers:nil)
217
+ delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
218
+ end
219
+
220
+ #
221
+ # Deletes a storage account in Microsoft Azure.
222
+ #
223
+ # @param resource_group_name [String] The name of the resource group within the
224
+ # user's subscription. The name is case insensitive.
225
+ # @param account_name [String] The name of the storage account within the
226
+ # specified resource group. Storage account names must be between 3 and 24
227
+ # characters in length and use numbers and lower-case letters only.
228
+ # @param [Hash{String => String}] A hash of custom headers that will be added
229
+ # to the HTTP request.
230
+ #
231
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
232
+ #
233
+ def delete_async(resource_group_name, account_name, custom_headers:nil)
234
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
235
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
236
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
237
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
238
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
239
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
240
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
241
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
242
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
243
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
244
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
245
+
246
+
247
+ request_headers = {}
248
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
249
+
250
+ # Set Headers
251
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
252
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
253
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
254
+
255
+ request_url = @base_url || @client.base_url
256
+
257
+ options = {
258
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
259
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
260
+ query_params: {'api-version' => @client.api_version},
261
+ headers: request_headers.merge(custom_headers || {}),
262
+ base_url: request_url
263
+ }
264
+ promise = @client.make_request_async(:delete, path_template, options)
265
+
266
+ promise = promise.then do |result|
267
+ http_response = result.response
268
+ status_code = http_response.status
269
+ response_content = http_response.body
270
+ unless status_code == 200 || status_code == 204
271
+ error_model = JSON.load(response_content)
272
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
273
+ end
274
+
275
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
276
+
277
+ result
278
+ end
279
+
280
+ promise.execute
281
+ end
282
+
283
+ #
284
+ # Returns the properties for the specified storage account including but not
285
+ # limited to name, SKU name, location, and account status. The ListKeys
286
+ # operation should be used to retrieve storage keys.
287
+ #
288
+ # @param resource_group_name [String] The name of the resource group within the
289
+ # user's subscription. The name is case insensitive.
290
+ # @param account_name [String] The name of the storage account within the
291
+ # specified resource group. Storage account names must be between 3 and 24
292
+ # characters in length and use numbers and lower-case letters only.
293
+ # @param expand [StorageAccountExpand] May be used to expand the properties
294
+ # within account's properties. By default, data is not included when fetching
295
+ # properties. Currently we only support geoReplicationStats. Possible values
296
+ # include: 'geoReplicationStats'
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [StorageAccount] operation results.
301
+ #
302
+ def get_properties(resource_group_name, account_name, expand:nil, custom_headers:nil)
303
+ response = get_properties_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
304
+ response.body unless response.nil?
305
+ end
306
+
307
+ #
308
+ # Returns the properties for the specified storage account including but not
309
+ # limited to name, SKU name, location, and account status. The ListKeys
310
+ # operation should be used to retrieve storage keys.
311
+ #
312
+ # @param resource_group_name [String] The name of the resource group within the
313
+ # user's subscription. The name is case insensitive.
314
+ # @param account_name [String] The name of the storage account within the
315
+ # specified resource group. Storage account names must be between 3 and 24
316
+ # characters in length and use numbers and lower-case letters only.
317
+ # @param expand [StorageAccountExpand] May be used to expand the properties
318
+ # within account's properties. By default, data is not included when fetching
319
+ # properties. Currently we only support geoReplicationStats. Possible values
320
+ # include: 'geoReplicationStats'
321
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
322
+ # will be added to the HTTP request.
323
+ #
324
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
325
+ #
326
+ def get_properties_with_http_info(resource_group_name, account_name, expand:nil, custom_headers:nil)
327
+ get_properties_async(resource_group_name, account_name, expand:expand, custom_headers:custom_headers).value!
328
+ end
329
+
330
+ #
331
+ # Returns the properties for the specified storage account including but not
332
+ # limited to name, SKU name, location, and account status. The ListKeys
333
+ # operation should be used to retrieve storage keys.
334
+ #
335
+ # @param resource_group_name [String] The name of the resource group within the
336
+ # user's subscription. The name is case insensitive.
337
+ # @param account_name [String] The name of the storage account within the
338
+ # specified resource group. Storage account names must be between 3 and 24
339
+ # characters in length and use numbers and lower-case letters only.
340
+ # @param expand [StorageAccountExpand] May be used to expand the properties
341
+ # within account's properties. By default, data is not included when fetching
342
+ # properties. Currently we only support geoReplicationStats. Possible values
343
+ # include: 'geoReplicationStats'
344
+ # @param [Hash{String => String}] A hash of custom headers that will be added
345
+ # to the HTTP request.
346
+ #
347
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
348
+ #
349
+ def get_properties_async(resource_group_name, account_name, expand:nil, custom_headers:nil)
350
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
351
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
352
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
353
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
354
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
355
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
356
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
357
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
358
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
359
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
360
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
361
+
362
+
363
+ request_headers = {}
364
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
365
+
366
+ # Set Headers
367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
369
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
370
+
371
+ request_url = @base_url || @client.base_url
372
+
373
+ options = {
374
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
375
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
376
+ query_params: {'api-version' => @client.api_version,'$expand' => expand},
377
+ headers: request_headers.merge(custom_headers || {}),
378
+ base_url: request_url
379
+ }
380
+ promise = @client.make_request_async(:get, path_template, options)
381
+
382
+ promise = promise.then do |result|
383
+ http_response = result.response
384
+ status_code = http_response.status
385
+ response_content = http_response.body
386
+ unless status_code == 200
387
+ error_model = JSON.load(response_content)
388
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
389
+ end
390
+
391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
392
+ # Deserialize Response
393
+ if status_code == 200
394
+ begin
395
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
396
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccount.mapper()
397
+ result.body = @client.deserialize(result_mapper, parsed_response)
398
+ rescue Exception => e
399
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
400
+ end
401
+ end
402
+
403
+ result
404
+ end
405
+
406
+ promise.execute
407
+ end
408
+
409
+ #
410
+ # The update operation can be used to update the SKU, encryption, access tier,
411
+ # or tags for a storage account. It can also be used to map the account to a
412
+ # custom domain. Only one custom domain is supported per storage account; the
413
+ # replacement/change of custom domain is not supported. In order to replace an
414
+ # old custom domain, the old value must be cleared/unregistered before a new
415
+ # value can be set. The update of multiple properties is supported. This call
416
+ # does not change the storage keys for the account. If you want to change the
417
+ # storage account keys, use the regenerate keys operation. The location and
418
+ # name of the storage account cannot be changed after creation.
419
+ #
420
+ # @param resource_group_name [String] The name of the resource group within the
421
+ # user's subscription. The name is case insensitive.
422
+ # @param account_name [String] The name of the storage account within the
423
+ # specified resource group. Storage account names must be between 3 and 24
424
+ # characters in length and use numbers and lower-case letters only.
425
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
426
+ # for the updated account.
427
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
428
+ # will be added to the HTTP request.
429
+ #
430
+ # @return [StorageAccount] operation results.
431
+ #
432
+ def update(resource_group_name, account_name, parameters, custom_headers:nil)
433
+ response = update_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
434
+ response.body unless response.nil?
435
+ end
436
+
437
+ #
438
+ # The update operation can be used to update the SKU, encryption, access tier,
439
+ # or tags for a storage account. It can also be used to map the account to a
440
+ # custom domain. Only one custom domain is supported per storage account; the
441
+ # replacement/change of custom domain is not supported. In order to replace an
442
+ # old custom domain, the old value must be cleared/unregistered before a new
443
+ # value can be set. The update of multiple properties is supported. This call
444
+ # does not change the storage keys for the account. If you want to change the
445
+ # storage account keys, use the regenerate keys operation. The location and
446
+ # name of the storage account cannot be changed after creation.
447
+ #
448
+ # @param resource_group_name [String] The name of the resource group within the
449
+ # user's subscription. The name is case insensitive.
450
+ # @param account_name [String] The name of the storage account within the
451
+ # specified resource group. Storage account names must be between 3 and 24
452
+ # characters in length and use numbers and lower-case letters only.
453
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
454
+ # for the updated account.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
459
+ #
460
+ def update_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
461
+ update_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
462
+ end
463
+
464
+ #
465
+ # The update operation can be used to update the SKU, encryption, access tier,
466
+ # or tags for a storage account. It can also be used to map the account to a
467
+ # custom domain. Only one custom domain is supported per storage account; the
468
+ # replacement/change of custom domain is not supported. In order to replace an
469
+ # old custom domain, the old value must be cleared/unregistered before a new
470
+ # value can be set. The update of multiple properties is supported. This call
471
+ # does not change the storage keys for the account. If you want to change the
472
+ # storage account keys, use the regenerate keys operation. The location and
473
+ # name of the storage account cannot be changed after creation.
474
+ #
475
+ # @param resource_group_name [String] The name of the resource group within the
476
+ # user's subscription. The name is case insensitive.
477
+ # @param account_name [String] The name of the storage account within the
478
+ # specified resource group. Storage account names must be between 3 and 24
479
+ # characters in length and use numbers and lower-case letters only.
480
+ # @param parameters [StorageAccountUpdateParameters] The parameters to provide
481
+ # for the updated account.
482
+ # @param [Hash{String => String}] A hash of custom headers that will be added
483
+ # to the HTTP request.
484
+ #
485
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
486
+ #
487
+ def update_async(resource_group_name, account_name, parameters, custom_headers:nil)
488
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
489
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
490
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
491
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
492
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
493
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
494
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
495
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
496
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
497
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
498
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
499
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
500
+
501
+
502
+ request_headers = {}
503
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
504
+
505
+ # Set Headers
506
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
507
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
508
+
509
+ # Serialize Request
510
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountUpdateParameters.mapper()
511
+ request_content = @client.serialize(request_mapper, parameters)
512
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
513
+
514
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
515
+
516
+ request_url = @base_url || @client.base_url
517
+
518
+ options = {
519
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
520
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
521
+ query_params: {'api-version' => @client.api_version},
522
+ body: request_content,
523
+ headers: request_headers.merge(custom_headers || {}),
524
+ base_url: request_url
525
+ }
526
+ promise = @client.make_request_async(:patch, path_template, options)
527
+
528
+ promise = promise.then do |result|
529
+ http_response = result.response
530
+ status_code = http_response.status
531
+ response_content = http_response.body
532
+ unless status_code == 200
533
+ error_model = JSON.load(response_content)
534
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
535
+ end
536
+
537
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
538
+ # Deserialize Response
539
+ if status_code == 200
540
+ begin
541
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
542
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccount.mapper()
543
+ result.body = @client.deserialize(result_mapper, parsed_response)
544
+ rescue Exception => e
545
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
546
+ end
547
+ end
548
+
549
+ result
550
+ end
551
+
552
+ promise.execute
553
+ end
554
+
555
+ #
556
+ # Lists all the storage accounts available under the subscription. Note that
557
+ # storage keys are not returned; use the ListKeys operation for this.
558
+ #
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [StorageAccountListResult] operation results.
563
+ #
564
+ def list(custom_headers:nil)
565
+ response = list_async(custom_headers:custom_headers).value!
566
+ response.body unless response.nil?
567
+ end
568
+
569
+ #
570
+ # Lists all the storage accounts available under the subscription. Note that
571
+ # storage keys are not returned; use the ListKeys operation for this.
572
+ #
573
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
574
+ # will be added to the HTTP request.
575
+ #
576
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
577
+ #
578
+ def list_with_http_info(custom_headers:nil)
579
+ list_async(custom_headers:custom_headers).value!
580
+ end
581
+
582
+ #
583
+ # Lists all the storage accounts available under the subscription. Note that
584
+ # storage keys are not returned; use the ListKeys operation for this.
585
+ #
586
+ # @param [Hash{String => String}] A hash of custom headers that will be added
587
+ # to the HTTP request.
588
+ #
589
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
590
+ #
591
+ def list_async(custom_headers:nil)
592
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
593
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
594
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
595
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
596
+
597
+
598
+ request_headers = {}
599
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
600
+
601
+ # Set Headers
602
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
603
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
604
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'
605
+
606
+ request_url = @base_url || @client.base_url
607
+
608
+ options = {
609
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
610
+ path_params: {'subscriptionId' => @client.subscription_id},
611
+ query_params: {'api-version' => @client.api_version},
612
+ headers: request_headers.merge(custom_headers || {}),
613
+ base_url: request_url
614
+ }
615
+ promise = @client.make_request_async(:get, path_template, options)
616
+
617
+ promise = promise.then do |result|
618
+ http_response = result.response
619
+ status_code = http_response.status
620
+ response_content = http_response.body
621
+ unless status_code == 200
622
+ error_model = JSON.load(response_content)
623
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
624
+ end
625
+
626
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
627
+ # Deserialize Response
628
+ if status_code == 200
629
+ begin
630
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
631
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountListResult.mapper()
632
+ result.body = @client.deserialize(result_mapper, parsed_response)
633
+ rescue Exception => e
634
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
635
+ end
636
+ end
637
+
638
+ result
639
+ end
640
+
641
+ promise.execute
642
+ end
643
+
644
+ #
645
+ # Lists all the storage accounts available under the given resource group. Note
646
+ # that storage keys are not returned; use the ListKeys operation for this.
647
+ #
648
+ # @param resource_group_name [String] The name of the resource group within the
649
+ # user's subscription. The name is case insensitive.
650
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
651
+ # will be added to the HTTP request.
652
+ #
653
+ # @return [StorageAccountListResult] operation results.
654
+ #
655
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
656
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
657
+ response.body unless response.nil?
658
+ end
659
+
660
+ #
661
+ # Lists all the storage accounts available under the given resource group. Note
662
+ # that storage keys are not returned; use the ListKeys operation for this.
663
+ #
664
+ # @param resource_group_name [String] The name of the resource group within the
665
+ # user's subscription. The name is case insensitive.
666
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
667
+ # will be added to the HTTP request.
668
+ #
669
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
670
+ #
671
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
672
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
673
+ end
674
+
675
+ #
676
+ # Lists all the storage accounts available under the given resource group. Note
677
+ # that storage keys are not returned; use the ListKeys operation for this.
678
+ #
679
+ # @param resource_group_name [String] The name of the resource group within the
680
+ # user's subscription. The name is case insensitive.
681
+ # @param [Hash{String => String}] A hash of custom headers that will be added
682
+ # to the HTTP request.
683
+ #
684
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
685
+ #
686
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
687
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
688
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
689
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
690
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
691
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
692
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
693
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
694
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
695
+
696
+
697
+ request_headers = {}
698
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
699
+
700
+ # Set Headers
701
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
702
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
703
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'
704
+
705
+ request_url = @base_url || @client.base_url
706
+
707
+ options = {
708
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
709
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
710
+ query_params: {'api-version' => @client.api_version},
711
+ headers: request_headers.merge(custom_headers || {}),
712
+ base_url: request_url
713
+ }
714
+ promise = @client.make_request_async(:get, path_template, options)
715
+
716
+ promise = promise.then do |result|
717
+ http_response = result.response
718
+ status_code = http_response.status
719
+ response_content = http_response.body
720
+ unless status_code == 200
721
+ error_model = JSON.load(response_content)
722
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
723
+ end
724
+
725
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
726
+ # Deserialize Response
727
+ if status_code == 200
728
+ begin
729
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
730
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountListResult.mapper()
731
+ result.body = @client.deserialize(result_mapper, parsed_response)
732
+ rescue Exception => e
733
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
734
+ end
735
+ end
736
+
737
+ result
738
+ end
739
+
740
+ promise.execute
741
+ end
742
+
743
+ #
744
+ # Lists the access keys for the specified storage account.
745
+ #
746
+ # @param resource_group_name [String] The name of the resource group within the
747
+ # user's subscription. The name is case insensitive.
748
+ # @param account_name [String] The name of the storage account within the
749
+ # specified resource group. Storage account names must be between 3 and 24
750
+ # characters in length and use numbers and lower-case letters only.
751
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
752
+ # will be added to the HTTP request.
753
+ #
754
+ # @return [StorageAccountListKeysResult] operation results.
755
+ #
756
+ def list_keys(resource_group_name, account_name, custom_headers:nil)
757
+ response = list_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
758
+ response.body unless response.nil?
759
+ end
760
+
761
+ #
762
+ # Lists the access keys for the specified storage account.
763
+ #
764
+ # @param resource_group_name [String] The name of the resource group within the
765
+ # user's subscription. The name is case insensitive.
766
+ # @param account_name [String] The name of the storage account within the
767
+ # specified resource group. Storage account names must be between 3 and 24
768
+ # characters in length and use numbers and lower-case letters only.
769
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
770
+ # will be added to the HTTP request.
771
+ #
772
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
773
+ #
774
+ def list_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
775
+ list_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
776
+ end
777
+
778
+ #
779
+ # Lists the access keys for the specified storage account.
780
+ #
781
+ # @param resource_group_name [String] The name of the resource group within the
782
+ # user's subscription. The name is case insensitive.
783
+ # @param account_name [String] The name of the storage account within the
784
+ # specified resource group. Storage account names must be between 3 and 24
785
+ # characters in length and use numbers and lower-case letters only.
786
+ # @param [Hash{String => String}] A hash of custom headers that will be added
787
+ # to the HTTP request.
788
+ #
789
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
790
+ #
791
+ def list_keys_async(resource_group_name, account_name, custom_headers:nil)
792
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
793
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
794
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
795
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
796
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
797
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
798
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
799
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
800
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
801
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
802
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
803
+
804
+
805
+ request_headers = {}
806
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
807
+
808
+ # Set Headers
809
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
810
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
811
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'
812
+
813
+ request_url = @base_url || @client.base_url
814
+
815
+ options = {
816
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
817
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
818
+ query_params: {'api-version' => @client.api_version},
819
+ headers: request_headers.merge(custom_headers || {}),
820
+ base_url: request_url
821
+ }
822
+ promise = @client.make_request_async(:post, path_template, options)
823
+
824
+ promise = promise.then do |result|
825
+ http_response = result.response
826
+ status_code = http_response.status
827
+ response_content = http_response.body
828
+ unless status_code == 200
829
+ error_model = JSON.load(response_content)
830
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
831
+ end
832
+
833
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
834
+ # Deserialize Response
835
+ if status_code == 200
836
+ begin
837
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
838
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountListKeysResult.mapper()
839
+ result.body = @client.deserialize(result_mapper, parsed_response)
840
+ rescue Exception => e
841
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
842
+ end
843
+ end
844
+
845
+ result
846
+ end
847
+
848
+ promise.execute
849
+ end
850
+
851
+ #
852
+ # Regenerates one of the access keys for the specified storage account.
853
+ #
854
+ # @param resource_group_name [String] The name of the resource group within the
855
+ # user's subscription. The name is case insensitive.
856
+ # @param account_name [String] The name of the storage account within the
857
+ # specified resource group. Storage account names must be between 3 and 24
858
+ # characters in length and use numbers and lower-case letters only.
859
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
860
+ # of the key which should be regenerated -- key1 or key2.
861
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
862
+ # will be added to the HTTP request.
863
+ #
864
+ # @return [StorageAccountListKeysResult] operation results.
865
+ #
866
+ def regenerate_key(resource_group_name, account_name, regenerate_key, custom_headers:nil)
867
+ response = regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:custom_headers).value!
868
+ response.body unless response.nil?
869
+ end
870
+
871
+ #
872
+ # Regenerates one of the access keys for the specified storage account.
873
+ #
874
+ # @param resource_group_name [String] The name of the resource group within the
875
+ # user's subscription. The name is case insensitive.
876
+ # @param account_name [String] The name of the storage account within the
877
+ # specified resource group. Storage account names must be between 3 and 24
878
+ # characters in length and use numbers and lower-case letters only.
879
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
880
+ # of the key which should be regenerated -- key1 or key2.
881
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
882
+ # will be added to the HTTP request.
883
+ #
884
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
885
+ #
886
+ def regenerate_key_with_http_info(resource_group_name, account_name, regenerate_key, custom_headers:nil)
887
+ regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:custom_headers).value!
888
+ end
889
+
890
+ #
891
+ # Regenerates one of the access keys for the specified storage account.
892
+ #
893
+ # @param resource_group_name [String] The name of the resource group within the
894
+ # user's subscription. The name is case insensitive.
895
+ # @param account_name [String] The name of the storage account within the
896
+ # specified resource group. Storage account names must be between 3 and 24
897
+ # characters in length and use numbers and lower-case letters only.
898
+ # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
899
+ # of the key which should be regenerated -- key1 or key2.
900
+ # @param [Hash{String => String}] A hash of custom headers that will be added
901
+ # to the HTTP request.
902
+ #
903
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
904
+ #
905
+ def regenerate_key_async(resource_group_name, account_name, regenerate_key, custom_headers:nil)
906
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
907
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
908
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
909
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
910
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
911
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
912
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
913
+ fail ArgumentError, 'regenerate_key is nil' if regenerate_key.nil?
914
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
915
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
916
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
917
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
918
+
919
+
920
+ request_headers = {}
921
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
922
+
923
+ # Set Headers
924
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
925
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
926
+
927
+ # Serialize Request
928
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountRegenerateKeyParameters.mapper()
929
+ request_content = @client.serialize(request_mapper, regenerate_key)
930
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
931
+
932
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'
933
+
934
+ request_url = @base_url || @client.base_url
935
+
936
+ options = {
937
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
938
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
939
+ query_params: {'api-version' => @client.api_version},
940
+ body: request_content,
941
+ headers: request_headers.merge(custom_headers || {}),
942
+ base_url: request_url
943
+ }
944
+ promise = @client.make_request_async(:post, path_template, options)
945
+
946
+ promise = promise.then do |result|
947
+ http_response = result.response
948
+ status_code = http_response.status
949
+ response_content = http_response.body
950
+ unless status_code == 200
951
+ error_model = JSON.load(response_content)
952
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
953
+ end
954
+
955
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
956
+ # Deserialize Response
957
+ if status_code == 200
958
+ begin
959
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
960
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountListKeysResult.mapper()
961
+ result.body = @client.deserialize(result_mapper, parsed_response)
962
+ rescue Exception => e
963
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
964
+ end
965
+ end
966
+
967
+ result
968
+ end
969
+
970
+ promise.execute
971
+ end
972
+
973
+ #
974
+ # List SAS credentials of a storage account.
975
+ #
976
+ # @param resource_group_name [String] The name of the resource group within the
977
+ # user's subscription. The name is case insensitive.
978
+ # @param account_name [String] The name of the storage account within the
979
+ # specified resource group. Storage account names must be between 3 and 24
980
+ # characters in length and use numbers and lower-case letters only.
981
+ # @param parameters [AccountSasParameters] The parameters to provide to list
982
+ # SAS credentials for the storage account.
983
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
984
+ # will be added to the HTTP request.
985
+ #
986
+ # @return [ListAccountSasResponse] operation results.
987
+ #
988
+ def list_account_sas(resource_group_name, account_name, parameters, custom_headers:nil)
989
+ response = list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
990
+ response.body unless response.nil?
991
+ end
992
+
993
+ #
994
+ # List SAS credentials of a storage account.
995
+ #
996
+ # @param resource_group_name [String] The name of the resource group within the
997
+ # user's subscription. The name is case insensitive.
998
+ # @param account_name [String] The name of the storage account within the
999
+ # specified resource group. Storage account names must be between 3 and 24
1000
+ # characters in length and use numbers and lower-case letters only.
1001
+ # @param parameters [AccountSasParameters] The parameters to provide to list
1002
+ # SAS credentials for the storage account.
1003
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1004
+ # will be added to the HTTP request.
1005
+ #
1006
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1007
+ #
1008
+ def list_account_sas_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1009
+ list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1010
+ end
1011
+
1012
+ #
1013
+ # List SAS credentials of a storage account.
1014
+ #
1015
+ # @param resource_group_name [String] The name of the resource group within the
1016
+ # user's subscription. The name is case insensitive.
1017
+ # @param account_name [String] The name of the storage account within the
1018
+ # specified resource group. Storage account names must be between 3 and 24
1019
+ # characters in length and use numbers and lower-case letters only.
1020
+ # @param parameters [AccountSasParameters] The parameters to provide to list
1021
+ # SAS credentials for the storage account.
1022
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1023
+ # to the HTTP request.
1024
+ #
1025
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1026
+ #
1027
+ def list_account_sas_async(resource_group_name, account_name, parameters, custom_headers:nil)
1028
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1029
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1030
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1031
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1032
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1033
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1034
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1035
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1036
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1037
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1038
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1039
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1040
+
1041
+
1042
+ request_headers = {}
1043
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1044
+
1045
+ # Set Headers
1046
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1047
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1048
+
1049
+ # Serialize Request
1050
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::AccountSasParameters.mapper()
1051
+ request_content = @client.serialize(request_mapper, parameters)
1052
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1053
+
1054
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListAccountSas'
1055
+
1056
+ request_url = @base_url || @client.base_url
1057
+
1058
+ options = {
1059
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1060
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1061
+ query_params: {'api-version' => @client.api_version},
1062
+ body: request_content,
1063
+ headers: request_headers.merge(custom_headers || {}),
1064
+ base_url: request_url
1065
+ }
1066
+ promise = @client.make_request_async(:post, path_template, options)
1067
+
1068
+ promise = promise.then do |result|
1069
+ http_response = result.response
1070
+ status_code = http_response.status
1071
+ response_content = http_response.body
1072
+ unless status_code == 200
1073
+ error_model = JSON.load(response_content)
1074
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1075
+ end
1076
+
1077
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1078
+ # Deserialize Response
1079
+ if status_code == 200
1080
+ begin
1081
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1082
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ListAccountSasResponse.mapper()
1083
+ result.body = @client.deserialize(result_mapper, parsed_response)
1084
+ rescue Exception => e
1085
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1086
+ end
1087
+ end
1088
+
1089
+ result
1090
+ end
1091
+
1092
+ promise.execute
1093
+ end
1094
+
1095
+ #
1096
+ # List service SAS credentials of a specific resource.
1097
+ #
1098
+ # @param resource_group_name [String] The name of the resource group within the
1099
+ # user's subscription. The name is case insensitive.
1100
+ # @param account_name [String] The name of the storage account within the
1101
+ # specified resource group. Storage account names must be between 3 and 24
1102
+ # characters in length and use numbers and lower-case letters only.
1103
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1104
+ # service SAS credentials.
1105
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1106
+ # will be added to the HTTP request.
1107
+ #
1108
+ # @return [ListServiceSasResponse] operation results.
1109
+ #
1110
+ def list_service_sas(resource_group_name, account_name, parameters, custom_headers:nil)
1111
+ response = list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1112
+ response.body unless response.nil?
1113
+ end
1114
+
1115
+ #
1116
+ # List service SAS credentials of a specific resource.
1117
+ #
1118
+ # @param resource_group_name [String] The name of the resource group within the
1119
+ # user's subscription. The name is case insensitive.
1120
+ # @param account_name [String] The name of the storage account within the
1121
+ # specified resource group. Storage account names must be between 3 and 24
1122
+ # characters in length and use numbers and lower-case letters only.
1123
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1124
+ # service SAS credentials.
1125
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1126
+ # will be added to the HTTP request.
1127
+ #
1128
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1129
+ #
1130
+ def list_service_sas_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1131
+ list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1132
+ end
1133
+
1134
+ #
1135
+ # List service SAS credentials of a specific resource.
1136
+ #
1137
+ # @param resource_group_name [String] The name of the resource group within the
1138
+ # user's subscription. The name is case insensitive.
1139
+ # @param account_name [String] The name of the storage account within the
1140
+ # specified resource group. Storage account names must be between 3 and 24
1141
+ # characters in length and use numbers and lower-case letters only.
1142
+ # @param parameters [ServiceSasParameters] The parameters to provide to list
1143
+ # service SAS credentials.
1144
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1145
+ # to the HTTP request.
1146
+ #
1147
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1148
+ #
1149
+ def list_service_sas_async(resource_group_name, account_name, parameters, custom_headers:nil)
1150
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1151
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1152
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1153
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1154
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1155
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1156
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1157
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1158
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1159
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1160
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1161
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1162
+
1163
+
1164
+ request_headers = {}
1165
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1166
+
1167
+ # Set Headers
1168
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1169
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1170
+
1171
+ # Serialize Request
1172
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ServiceSasParameters.mapper()
1173
+ request_content = @client.serialize(request_mapper, parameters)
1174
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1175
+
1176
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/ListServiceSas'
1177
+
1178
+ request_url = @base_url || @client.base_url
1179
+
1180
+ options = {
1181
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1182
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1183
+ query_params: {'api-version' => @client.api_version},
1184
+ body: request_content,
1185
+ headers: request_headers.merge(custom_headers || {}),
1186
+ base_url: request_url
1187
+ }
1188
+ promise = @client.make_request_async(:post, path_template, options)
1189
+
1190
+ promise = promise.then do |result|
1191
+ http_response = result.response
1192
+ status_code = http_response.status
1193
+ response_content = http_response.body
1194
+ unless status_code == 200
1195
+ error_model = JSON.load(response_content)
1196
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1197
+ end
1198
+
1199
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1200
+ # Deserialize Response
1201
+ if status_code == 200
1202
+ begin
1203
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1204
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::ListServiceSasResponse.mapper()
1205
+ result.body = @client.deserialize(result_mapper, parsed_response)
1206
+ rescue Exception => e
1207
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1208
+ end
1209
+ end
1210
+
1211
+ result
1212
+ end
1213
+
1214
+ promise.execute
1215
+ end
1216
+
1217
+ #
1218
+ # Failover request can be triggered for a storage account in case of
1219
+ # availability issues. The failover occurs from the storage account's primary
1220
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1221
+ # become primary after failover.
1222
+ #
1223
+ # @param resource_group_name [String] The name of the resource group within the
1224
+ # user's subscription. The name is case insensitive.
1225
+ # @param account_name [String] The name of the storage account within the
1226
+ # specified resource group. Storage account names must be between 3 and 24
1227
+ # characters in length and use numbers and lower-case letters only.
1228
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1229
+ # will be added to the HTTP request.
1230
+ #
1231
+ def failover(resource_group_name, account_name, custom_headers:nil)
1232
+ response = failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1233
+ nil
1234
+ end
1235
+
1236
+ #
1237
+ # @param resource_group_name [String] The name of the resource group within the
1238
+ # user's subscription. The name is case insensitive.
1239
+ # @param account_name [String] The name of the storage account within the
1240
+ # specified resource group. Storage account names must be between 3 and 24
1241
+ # characters in length and use numbers and lower-case letters only.
1242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1243
+ # will be added to the HTTP request.
1244
+ #
1245
+ # @return [Concurrent::Promise] promise which provides async access to http
1246
+ # response.
1247
+ #
1248
+ def failover_async(resource_group_name, account_name, custom_headers:nil)
1249
+ # Send request
1250
+ promise = begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers)
1251
+
1252
+ promise = promise.then do |response|
1253
+ # Defining deserialization method.
1254
+ deserialize_method = lambda do |parsed_response|
1255
+ end
1256
+
1257
+ # Waiting for response.
1258
+ @client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
1259
+ end
1260
+
1261
+ promise
1262
+ end
1263
+
1264
+ #
1265
+ # Revoke user delegation keys.
1266
+ #
1267
+ # @param resource_group_name [String] The name of the resource group within the
1268
+ # user's subscription. The name is case insensitive.
1269
+ # @param account_name [String] The name of the storage account within the
1270
+ # specified resource group. Storage account names must be between 3 and 24
1271
+ # characters in length and use numbers and lower-case letters only.
1272
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1273
+ # will be added to the HTTP request.
1274
+ #
1275
+ #
1276
+ def revoke_user_delegation_keys(resource_group_name, account_name, custom_headers:nil)
1277
+ response = revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1278
+ nil
1279
+ end
1280
+
1281
+ #
1282
+ # Revoke user delegation keys.
1283
+ #
1284
+ # @param resource_group_name [String] The name of the resource group within the
1285
+ # user's subscription. The name is case insensitive.
1286
+ # @param account_name [String] The name of the storage account within the
1287
+ # specified resource group. Storage account names must be between 3 and 24
1288
+ # characters in length and use numbers and lower-case letters only.
1289
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1290
+ # will be added to the HTTP request.
1291
+ #
1292
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1293
+ #
1294
+ def revoke_user_delegation_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
1295
+ revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1296
+ end
1297
+
1298
+ #
1299
+ # Revoke user delegation keys.
1300
+ #
1301
+ # @param resource_group_name [String] The name of the resource group within the
1302
+ # user's subscription. The name is case insensitive.
1303
+ # @param account_name [String] The name of the storage account within the
1304
+ # specified resource group. Storage account names must be between 3 and 24
1305
+ # characters in length and use numbers and lower-case letters only.
1306
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1307
+ # to the HTTP request.
1308
+ #
1309
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1310
+ #
1311
+ def revoke_user_delegation_keys_async(resource_group_name, account_name, custom_headers:nil)
1312
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1313
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1314
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1315
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1316
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1317
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1318
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1319
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1320
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1321
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1322
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1323
+
1324
+
1325
+ request_headers = {}
1326
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1327
+
1328
+ # Set Headers
1329
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1330
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1331
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/revokeUserDelegationKeys'
1332
+
1333
+ request_url = @base_url || @client.base_url
1334
+
1335
+ options = {
1336
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1337
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1338
+ query_params: {'api-version' => @client.api_version},
1339
+ headers: request_headers.merge(custom_headers || {}),
1340
+ base_url: request_url
1341
+ }
1342
+ promise = @client.make_request_async(:post, path_template, options)
1343
+
1344
+ promise = promise.then do |result|
1345
+ http_response = result.response
1346
+ status_code = http_response.status
1347
+ response_content = http_response.body
1348
+ unless status_code == 200
1349
+ error_model = JSON.load(response_content)
1350
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1351
+ end
1352
+
1353
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1354
+
1355
+ result
1356
+ end
1357
+
1358
+ promise.execute
1359
+ end
1360
+
1361
+ #
1362
+ # Asynchronously creates a new storage account with the specified parameters.
1363
+ # If an account is already created and a subsequent create request is issued
1364
+ # with different properties, the account properties will be updated. If an
1365
+ # account is already created and a subsequent create or update request is
1366
+ # issued with the exact same set of properties, the request will succeed.
1367
+ #
1368
+ # @param resource_group_name [String] The name of the resource group within the
1369
+ # user's subscription. The name is case insensitive.
1370
+ # @param account_name [String] The name of the storage account within the
1371
+ # specified resource group. Storage account names must be between 3 and 24
1372
+ # characters in length and use numbers and lower-case letters only.
1373
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1374
+ # for the created account.
1375
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1376
+ # will be added to the HTTP request.
1377
+ #
1378
+ # @return [StorageAccount] operation results.
1379
+ #
1380
+ def begin_create(resource_group_name, account_name, parameters, custom_headers:nil)
1381
+ response = begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1382
+ response.body unless response.nil?
1383
+ end
1384
+
1385
+ #
1386
+ # Asynchronously creates a new storage account with the specified parameters.
1387
+ # If an account is already created and a subsequent create request is issued
1388
+ # with different properties, the account properties will be updated. If an
1389
+ # account is already created and a subsequent create or update request is
1390
+ # issued with the exact same set of properties, the request will succeed.
1391
+ #
1392
+ # @param resource_group_name [String] The name of the resource group within the
1393
+ # user's subscription. The name is case insensitive.
1394
+ # @param account_name [String] The name of the storage account within the
1395
+ # specified resource group. Storage account names must be between 3 and 24
1396
+ # characters in length and use numbers and lower-case letters only.
1397
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1398
+ # for the created account.
1399
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1400
+ # will be added to the HTTP request.
1401
+ #
1402
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1403
+ #
1404
+ def begin_create_with_http_info(resource_group_name, account_name, parameters, custom_headers:nil)
1405
+ begin_create_async(resource_group_name, account_name, parameters, custom_headers:custom_headers).value!
1406
+ end
1407
+
1408
+ #
1409
+ # Asynchronously creates a new storage account with the specified parameters.
1410
+ # If an account is already created and a subsequent create request is issued
1411
+ # with different properties, the account properties will be updated. If an
1412
+ # account is already created and a subsequent create or update request is
1413
+ # issued with the exact same set of properties, the request will succeed.
1414
+ #
1415
+ # @param resource_group_name [String] The name of the resource group within the
1416
+ # user's subscription. The name is case insensitive.
1417
+ # @param account_name [String] The name of the storage account within the
1418
+ # specified resource group. Storage account names must be between 3 and 24
1419
+ # characters in length and use numbers and lower-case letters only.
1420
+ # @param parameters [StorageAccountCreateParameters] The parameters to provide
1421
+ # for the created account.
1422
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1423
+ # to the HTTP request.
1424
+ #
1425
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1426
+ #
1427
+ def begin_create_async(resource_group_name, account_name, parameters, custom_headers:nil)
1428
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1429
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1430
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1431
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1432
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1433
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1434
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1435
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1436
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1437
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1438
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1439
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1440
+
1441
+
1442
+ request_headers = {}
1443
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1444
+
1445
+ # Set Headers
1446
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1447
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1448
+
1449
+ # Serialize Request
1450
+ request_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccountCreateParameters.mapper()
1451
+ request_content = @client.serialize(request_mapper, parameters)
1452
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1453
+
1454
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
1455
+
1456
+ request_url = @base_url || @client.base_url
1457
+
1458
+ options = {
1459
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1460
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1461
+ query_params: {'api-version' => @client.api_version},
1462
+ body: request_content,
1463
+ headers: request_headers.merge(custom_headers || {}),
1464
+ base_url: request_url
1465
+ }
1466
+ promise = @client.make_request_async(:put, path_template, options)
1467
+
1468
+ promise = promise.then do |result|
1469
+ http_response = result.response
1470
+ status_code = http_response.status
1471
+ response_content = http_response.body
1472
+ unless status_code == 200 || status_code == 202
1473
+ error_model = JSON.load(response_content)
1474
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1475
+ end
1476
+
1477
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1478
+ # Deserialize Response
1479
+ if status_code == 200
1480
+ begin
1481
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1482
+ result_mapper = Azure::Storage::Mgmt::V2019_04_01::Models::StorageAccount.mapper()
1483
+ result.body = @client.deserialize(result_mapper, parsed_response)
1484
+ rescue Exception => e
1485
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1486
+ end
1487
+ end
1488
+
1489
+ result
1490
+ end
1491
+
1492
+ promise.execute
1493
+ end
1494
+
1495
+ #
1496
+ # Failover request can be triggered for a storage account in case of
1497
+ # availability issues. The failover occurs from the storage account's primary
1498
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1499
+ # become primary after failover.
1500
+ #
1501
+ # @param resource_group_name [String] The name of the resource group within the
1502
+ # user's subscription. The name is case insensitive.
1503
+ # @param account_name [String] The name of the storage account within the
1504
+ # specified resource group. Storage account names must be between 3 and 24
1505
+ # characters in length and use numbers and lower-case letters only.
1506
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1507
+ # will be added to the HTTP request.
1508
+ #
1509
+ #
1510
+ def begin_failover(resource_group_name, account_name, custom_headers:nil)
1511
+ response = begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1512
+ nil
1513
+ end
1514
+
1515
+ #
1516
+ # Failover request can be triggered for a storage account in case of
1517
+ # availability issues. The failover occurs from the storage account's primary
1518
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1519
+ # become primary after failover.
1520
+ #
1521
+ # @param resource_group_name [String] The name of the resource group within the
1522
+ # user's subscription. The name is case insensitive.
1523
+ # @param account_name [String] The name of the storage account within the
1524
+ # specified resource group. Storage account names must be between 3 and 24
1525
+ # characters in length and use numbers and lower-case letters only.
1526
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1527
+ # will be added to the HTTP request.
1528
+ #
1529
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1530
+ #
1531
+ def begin_failover_with_http_info(resource_group_name, account_name, custom_headers:nil)
1532
+ begin_failover_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1533
+ end
1534
+
1535
+ #
1536
+ # Failover request can be triggered for a storage account in case of
1537
+ # availability issues. The failover occurs from the storage account's primary
1538
+ # cluster to secondary cluster for RA-GRS accounts. The secondary cluster will
1539
+ # become primary after failover.
1540
+ #
1541
+ # @param resource_group_name [String] The name of the resource group within the
1542
+ # user's subscription. The name is case insensitive.
1543
+ # @param account_name [String] The name of the storage account within the
1544
+ # specified resource group. Storage account names must be between 3 and 24
1545
+ # characters in length and use numbers and lower-case letters only.
1546
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1547
+ # to the HTTP request.
1548
+ #
1549
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1550
+ #
1551
+ def begin_failover_async(resource_group_name, account_name, custom_headers:nil)
1552
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1553
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1554
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1555
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1556
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1557
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '24'" if !account_name.nil? && account_name.length > 24
1558
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1559
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1560
+ fail ArgumentError, "'@client.api_version' should satisfy the constraint - 'MinLength': '1'" if !@client.api_version.nil? && @client.api_version.length < 1
1561
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1562
+ fail ArgumentError, "'@client.subscription_id' should satisfy the constraint - 'MinLength': '1'" if !@client.subscription_id.nil? && @client.subscription_id.length < 1
1563
+
1564
+
1565
+ request_headers = {}
1566
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1567
+
1568
+ # Set Headers
1569
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1570
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1571
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'
1572
+
1573
+ request_url = @base_url || @client.base_url
1574
+
1575
+ options = {
1576
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1577
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
1578
+ query_params: {'api-version' => @client.api_version},
1579
+ headers: request_headers.merge(custom_headers || {}),
1580
+ base_url: request_url
1581
+ }
1582
+ promise = @client.make_request_async(:post, path_template, options)
1583
+
1584
+ promise = promise.then do |result|
1585
+ http_response = result.response
1586
+ status_code = http_response.status
1587
+ response_content = http_response.body
1588
+ unless status_code == 200 || status_code == 202
1589
+ error_model = JSON.load(response_content)
1590
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1591
+ end
1592
+
1593
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1594
+
1595
+ result
1596
+ end
1597
+
1598
+ promise.execute
1599
+ end
1600
+
1601
+ end
1602
+ end