azure_mgmt_storage 0.16.1 → 0.16.2

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