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