azure_mgmt_storage 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_storage.gemspec +3 -8
  3. data/lib/azure_mgmt_storage.rb +3 -8
  4. data/lib/azure_mgmt_storage/models/account_status.rb +1 -1
  5. data/lib/azure_mgmt_storage/models/account_type.rb +1 -1
  6. data/lib/azure_mgmt_storage/models/check_name_availability_result.rb +3 -6
  7. data/lib/azure_mgmt_storage/models/custom_domain.rb +2 -4
  8. data/lib/azure_mgmt_storage/models/endpoints.rb +9 -2
  9. data/lib/azure_mgmt_storage/models/provisioning_state.rb +1 -1
  10. data/lib/azure_mgmt_storage/models/reason.rb +1 -1
  11. data/lib/azure_mgmt_storage/models/storage_account.rb +7 -9
  12. data/lib/azure_mgmt_storage/models/storage_account_check_name_availability_parameters.rb +2 -4
  13. data/lib/azure_mgmt_storage/models/storage_account_create_parameters.rb +10 -22
  14. data/lib/azure_mgmt_storage/models/storage_account_keys.rb +1 -3
  15. data/lib/azure_mgmt_storage/models/storage_account_list_result.rb +4 -16
  16. data/lib/azure_mgmt_storage/models/storage_account_properties.rb +11 -14
  17. data/lib/azure_mgmt_storage/models/storage_account_properties_create_parameters.rb +5 -6
  18. data/lib/azure_mgmt_storage/models/storage_account_properties_update_parameters.rb +4 -7
  19. data/lib/azure_mgmt_storage/models/storage_account_regenerate_key_parameters.rb +3 -9
  20. data/lib/azure_mgmt_storage/models/storage_account_update_parameters.rb +6 -28
  21. data/lib/azure_mgmt_storage/models/usage.rb +9 -7
  22. data/lib/azure_mgmt_storage/models/usage_list_result.rb +4 -6
  23. data/lib/azure_mgmt_storage/models/usage_name.rb +1 -3
  24. data/lib/azure_mgmt_storage/models/usage_unit.rb +1 -1
  25. data/lib/azure_mgmt_storage/module_definition.rb +5 -3
  26. data/lib/azure_mgmt_storage/storage_accounts.rb +187 -591
  27. data/lib/azure_mgmt_storage/storage_management_client.rb +14 -7
  28. data/lib/azure_mgmt_storage/usage_operations.rb +20 -45
  29. data/lib/azure_mgmt_storage/version.rb +5 -3
  30. metadata +7 -87
  31. data/.gitignore +0 -10
  32. data/.travis.yml +0 -3
  33. data/Gemfile +0 -15
  34. data/lib/azure_mgmt_storage/models/key_name.rb +0 -16
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -13,14 +13,15 @@ module Azure::ARM::Storage
13
13
  include MsRestAzure
14
14
 
15
15
  # @return [AccountType] Gets or sets the account type. Possible values
16
- # for this property include: 'Standard_LRS', 'Standard_ZRS',
17
- # 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS'.
16
+ # include: 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS',
17
+ # 'Standard_RAGRS', 'Premium_LRS'
18
18
  attr_accessor :account_type
19
19
 
20
20
  #
21
21
  # Validate the object. Throws ValidationError if validation fails.
22
22
  #
23
23
  def validate
24
+ fail MsRest::ValidationError, 'property account_type is nil' if @account_type.nil?
24
25
  end
25
26
 
26
27
  #
@@ -50,12 +51,10 @@ module Azure::ARM::Storage
50
51
  deserialized_property = object['accountType']
51
52
  if (!deserialized_property.nil? && !deserialized_property.empty?)
52
53
  enum_is_valid = AccountType.constants.any? { |e| AccountType.const_get(e).to_s.downcase == deserialized_property.downcase }
53
- fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
54
+ warn 'Enum AccountType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
54
55
  end
55
56
  output_object.account_type = deserialized_property
56
57
 
57
- output_object.validate
58
-
59
58
  output_object
60
59
  end
61
60
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -15,9 +15,8 @@ module Azure::ARM::Storage
15
15
  # @return [AccountType] Gets or sets the account type. Note that
16
16
  # StandardZRS and PremiumLRS accounts cannot be changed to other
17
17
  # account types, and other account types cannot be changed to
18
- # StandardZRS or PremiumLRS. Possible values for this property include:
19
- # 'Standard_LRS', 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS',
20
- # 'Premium_LRS'.
18
+ # StandardZRS or PremiumLRS. Possible values include: 'Standard_LRS',
19
+ # 'Standard_ZRS', 'Standard_GRS', 'Standard_RAGRS', 'Premium_LRS'
21
20
  attr_accessor :account_type
22
21
 
23
22
  # @return [CustomDomain] User domain assigned to the storage account.
@@ -66,7 +65,7 @@ module Azure::ARM::Storage
66
65
  deserialized_property = object['accountType']
67
66
  if (!deserialized_property.nil? && !deserialized_property.empty?)
68
67
  enum_is_valid = AccountType.constants.any? { |e| AccountType.const_get(e).to_s.downcase == deserialized_property.downcase }
69
- fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
68
+ warn 'Enum AccountType does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
70
69
  end
71
70
  output_object.account_type = deserialized_property
72
71
 
@@ -76,8 +75,6 @@ module Azure::ARM::Storage
76
75
  end
77
76
  output_object.custom_domain = deserialized_property
78
77
 
79
- output_object.validate
80
-
81
78
  output_object
82
79
  end
83
80
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -12,14 +12,14 @@ module Azure::ARM::Storage
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [KeyName] Possible values for this property include: 'key1',
16
- # 'key2'.
15
+ # @return [String]
17
16
  attr_accessor :key_name
18
17
 
19
18
  #
20
19
  # Validate the object. Throws ValidationError if validation fails.
21
20
  #
22
21
  def validate
22
+ fail MsRest::ValidationError, 'property key_name is nil' if @key_name.nil?
23
23
  end
24
24
 
25
25
  #
@@ -47,14 +47,8 @@ module Azure::ARM::Storage
47
47
  output_object = StorageAccountRegenerateKeyParameters.new
48
48
 
49
49
  deserialized_property = object['keyName']
50
- if (!deserialized_property.nil? && !deserialized_property.empty?)
51
- enum_is_valid = KeyName.constants.any? { |e| KeyName.const_get(e).to_s.downcase == deserialized_property.downcase }
52
- fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
53
- end
54
50
  output_object.key_name = deserialized_property
55
51
 
56
- output_object.validate
57
-
58
52
  output_object
59
53
  end
60
54
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -8,10 +8,13 @@ module Azure::ARM::Storage
8
8
  #
9
9
  # The parameters to update on the account.
10
10
  #
11
- class StorageAccountUpdateParameters < MsRestAzure::Resource
11
+ class StorageAccountUpdateParameters
12
12
 
13
13
  include MsRestAzure
14
14
 
15
+ # @return [Hash{String => String}] Resource tags
16
+ attr_accessor :tags
17
+
15
18
  # @return [StorageAccountPropertiesUpdateParameters]
16
19
  attr_accessor :properties
17
20
 
@@ -19,6 +22,7 @@ module Azure::ARM::Storage
19
22
  # Validate the object. Throws ValidationError if validation fails.
20
23
  #
21
24
  def validate
25
+ @tags.each{ |e| e.validate if e.respond_to?(:validate) } unless @tags.nil?
22
26
  @properties.validate unless @properties.nil?
23
27
  end
24
28
 
@@ -31,18 +35,6 @@ module Azure::ARM::Storage
31
35
  object.validate
32
36
  output_object = {}
33
37
 
34
- serialized_property = object.location
35
- output_object['location'] = serialized_property unless serialized_property.nil?
36
-
37
- serialized_property = object.id
38
- output_object['id'] = serialized_property unless serialized_property.nil?
39
-
40
- serialized_property = object.name
41
- output_object['name'] = serialized_property unless serialized_property.nil?
42
-
43
- serialized_property = object.type
44
- output_object['type'] = serialized_property unless serialized_property.nil?
45
-
46
38
  serialized_property = object.tags
47
39
  output_object['tags'] = serialized_property unless serialized_property.nil?
48
40
 
@@ -64,18 +56,6 @@ module Azure::ARM::Storage
64
56
  return if object.nil?
65
57
  output_object = StorageAccountUpdateParameters.new
66
58
 
67
- deserialized_property = object['location']
68
- output_object.location = deserialized_property
69
-
70
- deserialized_property = object['id']
71
- output_object.id = deserialized_property
72
-
73
- deserialized_property = object['name']
74
- output_object.name = deserialized_property
75
-
76
- deserialized_property = object['type']
77
- output_object.type = deserialized_property
78
-
79
59
  deserialized_property = object['tags']
80
60
  output_object.tags = deserialized_property
81
61
 
@@ -85,8 +65,6 @@ module Azure::ARM::Storage
85
65
  end
86
66
  output_object.properties = deserialized_property
87
67
 
88
- output_object.validate
89
-
90
68
  output_object
91
69
  end
92
70
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -12,9 +12,9 @@ module Azure::ARM::Storage
12
12
 
13
13
  include MsRestAzure
14
14
 
15
- # @return [UsageUnit] Gets the unit of measurement. Possible values for
16
- # this property include: 'Count', 'Bytes', 'Seconds', 'Percent',
17
- # 'CountsPerSecond', 'BytesPerSecond'.
15
+ # @return [UsageUnit] Gets the unit of measurement. Possible values
16
+ # include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountsPerSecond',
17
+ # 'BytesPerSecond'
18
18
  attr_accessor :unit
19
19
 
20
20
  # @return [Integer] Gets the current count of the allocated resources in
@@ -32,6 +32,10 @@ module Azure::ARM::Storage
32
32
  # Validate the object. Throws ValidationError if validation fails.
33
33
  #
34
34
  def validate
35
+ fail MsRest::ValidationError, 'property unit is nil' if @unit.nil?
36
+ fail MsRest::ValidationError, 'property current_value is nil' if @current_value.nil?
37
+ fail MsRest::ValidationError, 'property limit is nil' if @limit.nil?
38
+ fail MsRest::ValidationError, 'property name is nil' if @name.nil?
35
39
  @name.validate unless @name.nil?
36
40
  end
37
41
 
@@ -74,7 +78,7 @@ module Azure::ARM::Storage
74
78
  deserialized_property = object['unit']
75
79
  if (!deserialized_property.nil? && !deserialized_property.empty?)
76
80
  enum_is_valid = UsageUnit.constants.any? { |e| UsageUnit.const_get(e).to_s.downcase == deserialized_property.downcase }
77
- fail MsRest::DeserializationError.new('Error occured while deserializing the enum', nil, nil, nil) unless enum_is_valid
81
+ warn 'Enum UsageUnit does not contain ' + deserialized_property.downcase + ', but was received from the server.' unless enum_is_valid
78
82
  end
79
83
  output_object.unit = deserialized_property
80
84
 
@@ -92,8 +96,6 @@ module Azure::ARM::Storage
92
96
  end
93
97
  output_object.name = deserialized_property
94
98
 
95
- output_object.validate
96
-
97
99
  output_object
98
100
  end
99
101
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -58,19 +58,17 @@ module Azure::ARM::Storage
58
58
 
59
59
  deserialized_property = object['value']
60
60
  unless deserialized_property.nil?
61
- deserializedArray = [];
61
+ deserialized_array = []
62
62
  deserialized_property.each do |element1|
63
63
  unless element1.nil?
64
64
  element1 = Usage.deserialize_object(element1)
65
65
  end
66
- deserializedArray.push(element1);
66
+ deserialized_array.push(element1)
67
67
  end
68
- deserialized_property = deserializedArray;
68
+ deserialized_property = deserialized_array
69
69
  end
70
70
  output_object.value = deserialized_property
71
71
 
72
- output_object.validate
73
-
74
72
  output_object
75
73
  end
76
74
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -58,8 +58,6 @@ module Azure::ARM::Storage
58
58
  deserialized_property = object['localizedValue']
59
59
  output_object.localized_value = deserialized_property
60
60
 
61
- output_object.validate
62
-
63
61
  output_object
64
62
  end
65
63
  end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -1,6 +1,8 @@
1
- # Copyright (c) Microsoft Corporation. All rights reserved.
2
- # Licensed under the MIT License. See License.txt in the project root for license information.
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
3
5
 
4
6
  module Azure end
5
7
  module Azure::ARM end
6
- module Azure::ARM::Storage end
8
+ module Azure::ARM::Storage end
@@ -1,11 +1,11 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Storage
7
7
  #
8
- # StorageAccounts
8
+ # The Storage Management Client.
9
9
  #
10
10
  class StorageAccounts
11
11
  include Azure::ARM::Storage::Models
@@ -24,6 +24,7 @@ module Azure::ARM::Storage
24
24
 
25
25
  #
26
26
  # Checks that account name is valid and is not in use.
27
+ #
27
28
  # @param account_name [StorageAccountCheckNameAvailabilityParameters] The name
28
29
  # of the storage account within the specified resource group. Storage account
29
30
  # names must be between 3 and 24 characters in length and use numbers and
@@ -39,78 +40,52 @@ module Azure::ARM::Storage
39
40
  account_name.validate unless account_name.nil?
40
41
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
41
42
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
42
- # Construct URL
43
- path = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability"
44
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
45
- url = URI.join(@client.base_url, path)
46
- properties = {}
47
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
48
- unless url.query.nil?
49
- url.query.split('&').each do |url_item|
50
- url_items_parts = url_item.split('=')
51
- properties[url_items_parts[0]] = url_items_parts[1]
52
- end
53
- end
54
- properties.reject!{ |key, value| value.nil? }
55
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
56
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
57
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
58
- url = URI.parse(corrected_url)
59
-
60
- connection = Faraday.new(:url => url) do |faraday|
61
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
62
- faraday.use :cookie_jar
63
- faraday.adapter Faraday.default_adapter
64
- end
65
- request_headers = Hash.new
43
+ request_headers = {}
66
44
 
67
45
  # Set Headers
68
46
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
69
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
70
-
71
- unless custom_headers.nil?
72
- custom_headers.each do |key, value|
73
- request_headers[key] = value
74
- end
75
- end
47
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
76
48
 
77
49
  # Serialize Request
78
- request_headers['Content-Type'] = 'application/json'
50
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
79
51
  unless account_name.nil?
80
52
  account_name = StorageAccountCheckNameAvailabilityParameters.serialize_object(account_name)
81
53
  end
82
54
  request_content = JSON.generate(account_name, quirks_mode: true)
83
-
84
- # Send Request
85
- promise = Concurrent::Promise.new do
86
- connection.post do |request|
87
- request.headers = request_headers
88
- request.body = request_content
89
- @client.credentials.sign_request(request) unless @client.credentials.nil?
90
- end
55
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/checkNameAvailability'
56
+ options = {
57
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
58
+ path_params: {'subscriptionId' => @client.subscription_id},
59
+ query_params: {'api-version' => @client.api_version},
60
+ body: request_content,
61
+ headers: request_headers.merge(custom_headers || {})
62
+ }
63
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
64
+ promise = request.run_promise do |req|
65
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
91
66
  end
92
67
 
93
68
  promise = promise.then do |http_response|
94
69
  status_code = http_response.status
95
70
  response_content = http_response.body
96
- unless (status_code == 200)
71
+ unless status_code == 200
97
72
  error_model = JSON.load(response_content)
98
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
73
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
99
74
  end
100
75
 
101
76
  # Create Result
102
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
77
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
103
78
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
104
79
  # Deserialize Response
105
80
  if status_code == 200
106
81
  begin
107
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
82
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
108
83
  unless parsed_response.nil?
109
84
  parsed_response = CheckNameAvailabilityResult.deserialize_object(parsed_response)
110
85
  end
111
86
  result.body = parsed_response
112
87
  rescue Exception => e
113
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
88
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
114
89
  end
115
90
  end
116
91
 
@@ -126,8 +101,9 @@ module Azure::ARM::Storage
126
101
  # the Update Storage Account API. If an account is already created and
127
102
  # subsequent PUT request is issued with exact same set of properties, then
128
103
  # HTTP 200 would be returned.
104
+ #
129
105
  # @param resource_group_name [String] The name of the resource group within
130
- # the user’s subscription.
106
+ # the user's subscription.
131
107
  # @param account_name [String] The name of the storage account within the
132
108
  # specified resource group. Storage account names must be between 3 and 24
133
109
  # characters in length and use numbers and lower-case letters only.
@@ -156,7 +132,7 @@ module Azure::ARM::Storage
156
132
  end
157
133
 
158
134
  # Waiting for response.
159
- @client.get_put_operation_result(response, custom_headers, deserialize_method)
135
+ @client.get_put_operation_result(response, deserialize_method)
160
136
  end
161
137
 
162
138
  promise
@@ -168,8 +144,9 @@ module Azure::ARM::Storage
168
144
  # the Update Storage Account API. If an account is already created and
169
145
  # subsequent PUT request is issued with exact same set of properties, then
170
146
  # HTTP 200 would be returned.
147
+ #
171
148
  # @param resource_group_name [String] The name of the resource group within
172
- # the user’s subscription.
149
+ # the user's subscription.
173
150
  # @param account_name [String] The name of the storage account within the
174
151
  # specified resource group. Storage account names must be between 3 and 24
175
152
  # characters in length and use numbers and lower-case letters only.
@@ -188,80 +165,52 @@ module Azure::ARM::Storage
188
165
  parameters.validate unless parameters.nil?
189
166
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
190
167
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
191
- # Construct URL
192
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
193
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
194
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
195
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
196
- url = URI.join(@client.base_url, path)
197
- properties = {}
198
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
199
- unless url.query.nil?
200
- url.query.split('&').each do |url_item|
201
- url_items_parts = url_item.split('=')
202
- properties[url_items_parts[0]] = url_items_parts[1]
203
- end
204
- end
205
- properties.reject!{ |key, value| value.nil? }
206
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
207
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
208
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
209
- url = URI.parse(corrected_url)
210
-
211
- connection = Faraday.new(:url => url) do |faraday|
212
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
213
- faraday.use :cookie_jar
214
- faraday.adapter Faraday.default_adapter
215
- end
216
- request_headers = Hash.new
168
+ request_headers = {}
217
169
 
218
170
  # Set Headers
219
171
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
220
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
221
-
222
- unless custom_headers.nil?
223
- custom_headers.each do |key, value|
224
- request_headers[key] = value
225
- end
226
- end
172
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
227
173
 
228
174
  # Serialize Request
229
- request_headers['Content-Type'] = 'application/json'
175
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
230
176
  unless parameters.nil?
231
177
  parameters = StorageAccountCreateParameters.serialize_object(parameters)
232
178
  end
233
179
  request_content = JSON.generate(parameters, quirks_mode: true)
234
-
235
- # Send Request
236
- promise = Concurrent::Promise.new do
237
- connection.put do |request|
238
- request.headers = request_headers
239
- request.body = request_content
240
- @client.credentials.sign_request(request) unless @client.credentials.nil?
241
- end
180
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
181
+ options = {
182
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
183
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
184
+ query_params: {'api-version' => @client.api_version},
185
+ body: request_content,
186
+ headers: request_headers.merge(custom_headers || {})
187
+ }
188
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
189
+ promise = request.run_promise do |req|
190
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
242
191
  end
243
192
 
244
193
  promise = promise.then do |http_response|
245
194
  status_code = http_response.status
246
195
  response_content = http_response.body
247
- unless (status_code == 200 || status_code == 202)
196
+ unless status_code == 200 || status_code == 202
248
197
  error_model = JSON.load(response_content)
249
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
198
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
250
199
  end
251
200
 
252
201
  # Create Result
253
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
202
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
254
203
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
255
204
  # Deserialize Response
256
205
  if status_code == 200
257
206
  begin
258
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
207
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
259
208
  unless parsed_response.nil?
260
209
  parsed_response = StorageAccount.deserialize_object(parsed_response)
261
210
  end
262
211
  result.body = parsed_response
263
212
  rescue Exception => e
264
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
213
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
265
214
  end
266
215
  end
267
216
 
@@ -273,8 +222,9 @@ module Azure::ARM::Storage
273
222
 
274
223
  #
275
224
  # Deletes a storage account in Microsoft Azure.
225
+ #
276
226
  # @param resource_group_name [String] The name of the resource group within
277
- # the user’s subscription.
227
+ # the user's subscription.
278
228
  # @param account_name [String] The name of the storage account within the
279
229
  # specified resource group. Storage account names must be between 3 and 24
280
230
  # characters in length and use numbers and lower-case letters only.
@@ -289,60 +239,33 @@ module Azure::ARM::Storage
289
239
  fail ArgumentError, 'account_name is nil' if account_name.nil?
290
240
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
291
241
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
292
- # Construct URL
293
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
294
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
295
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
296
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
297
- url = URI.join(@client.base_url, path)
298
- properties = {}
299
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
300
- unless url.query.nil?
301
- url.query.split('&').each do |url_item|
302
- url_items_parts = url_item.split('=')
303
- properties[url_items_parts[0]] = url_items_parts[1]
304
- end
305
- end
306
- properties.reject!{ |key, value| value.nil? }
307
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
308
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
309
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
310
- url = URI.parse(corrected_url)
311
-
312
- connection = Faraday.new(:url => url) do |faraday|
313
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
314
- faraday.use :cookie_jar
315
- faraday.adapter Faraday.default_adapter
316
- end
317
- request_headers = Hash.new
242
+ request_headers = {}
318
243
 
319
244
  # Set Headers
320
245
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
321
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
322
-
323
- unless custom_headers.nil?
324
- custom_headers.each do |key, value|
325
- request_headers[key] = value
326
- end
327
- end
328
-
329
- # Send Request
330
- promise = Concurrent::Promise.new do
331
- connection.delete do |request|
332
- request.headers = request_headers
333
- @client.credentials.sign_request(request) unless @client.credentials.nil?
334
- end
246
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
247
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
248
+ options = {
249
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
250
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
251
+ query_params: {'api-version' => @client.api_version},
252
+ headers: request_headers.merge(custom_headers || {})
253
+ }
254
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
255
+ promise = request.run_promise do |req|
256
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
335
257
  end
336
258
 
337
259
  promise = promise.then do |http_response|
338
260
  status_code = http_response.status
339
261
  response_content = http_response.body
340
- unless (status_code == 200 || status_code == 204)
341
- fail MsRestAzure::AzureOperationError.new(connection, http_response)
262
+ unless status_code == 200 || status_code == 204
263
+ error_model = JSON.load(response_content)
264
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
342
265
  end
343
266
 
344
267
  # Create Result
345
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
268
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
346
269
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
347
270
 
348
271
  result
@@ -355,8 +278,9 @@ module Azure::ARM::Storage
355
278
  # Returns the properties for the specified storage account including but not
356
279
  # limited to name, account type, location, and account status. The ListKeys
357
280
  # operation should be used to retrieve storage keys.
281
+ #
358
282
  # @param resource_group_name [String] The name of the resource group within
359
- # the user’s subscription.
283
+ # the user's subscription.
360
284
  # @param account_name [String] The name of the storage account within the
361
285
  # specified resource group. Storage account names must be between 3 and 24
362
286
  # characters in length and use numbers and lower-case letters only.
@@ -371,72 +295,44 @@ module Azure::ARM::Storage
371
295
  fail ArgumentError, 'account_name is nil' if account_name.nil?
372
296
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
373
297
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
374
- # Construct URL
375
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
376
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
377
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
378
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
379
- url = URI.join(@client.base_url, path)
380
- properties = {}
381
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
382
- unless url.query.nil?
383
- url.query.split('&').each do |url_item|
384
- url_items_parts = url_item.split('=')
385
- properties[url_items_parts[0]] = url_items_parts[1]
386
- end
387
- end
388
- properties.reject!{ |key, value| value.nil? }
389
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
390
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
391
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
392
- url = URI.parse(corrected_url)
393
-
394
- connection = Faraday.new(:url => url) do |faraday|
395
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
396
- faraday.use :cookie_jar
397
- faraday.adapter Faraday.default_adapter
398
- end
399
- request_headers = Hash.new
298
+ request_headers = {}
400
299
 
401
300
  # Set Headers
402
301
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
403
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
404
-
405
- unless custom_headers.nil?
406
- custom_headers.each do |key, value|
407
- request_headers[key] = value
408
- end
409
- end
410
-
411
- # Send Request
412
- promise = Concurrent::Promise.new do
413
- connection.get do |request|
414
- request.headers = request_headers
415
- @client.credentials.sign_request(request) unless @client.credentials.nil?
416
- end
302
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
303
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
304
+ options = {
305
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
306
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
307
+ query_params: {'api-version' => @client.api_version},
308
+ headers: request_headers.merge(custom_headers || {})
309
+ }
310
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
311
+ promise = request.run_promise do |req|
312
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
417
313
  end
418
314
 
419
315
  promise = promise.then do |http_response|
420
316
  status_code = http_response.status
421
317
  response_content = http_response.body
422
- unless (status_code == 200)
318
+ unless status_code == 200
423
319
  error_model = JSON.load(response_content)
424
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
320
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
425
321
  end
426
322
 
427
323
  # Create Result
428
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
324
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
429
325
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
430
326
  # Deserialize Response
431
327
  if status_code == 200
432
328
  begin
433
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
329
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
434
330
  unless parsed_response.nil?
435
331
  parsed_response = StorageAccount.deserialize_object(parsed_response)
436
332
  end
437
333
  result.body = parsed_response
438
334
  rescue Exception => e
439
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
335
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
440
336
  end
441
337
  end
442
338
 
@@ -450,14 +346,18 @@ module Azure::ARM::Storage
450
346
  # Updates the account type or tags for a storage account. It can also be used
451
347
  # to add a custom domain (note that custom domains cannot be added via the
452
348
  # Create operation). Only one custom domain is supported per storage account.
453
- # This API can only be used to update one of tags, accountType, or
454
- # customDomain per call. To update multiple of these properties, call the API
455
- # multiple times with one change per call. This call does not change the
349
+ # In order to replace a custom domain, the old value must be cleared before a
350
+ # new value may be set. To clear a custom domain, simply update the custom
351
+ # domain with empty string. Then call update again with the new cutsom domain
352
+ # name. The update API can only be used to update one of tags, accountType,
353
+ # or customDomain per call. To update multiple of these properties, call the
354
+ # API multiple times with one change per call. This call does not change the
456
355
  # storage keys for the account. If you want to change storage account keys,
457
356
  # use the RegenerateKey operation. The location and name of the storage
458
357
  # account cannot be changed after creation.
358
+ #
459
359
  # @param resource_group_name [String] The name of the resource group within
460
- # the user’s subscription.
360
+ # the user's subscription.
461
361
  # @param account_name [String] The name of the storage account within the
462
362
  # specified resource group. Storage account names must be between 3 and 24
463
363
  # characters in length and use numbers and lower-case letters only.
@@ -477,80 +377,52 @@ module Azure::ARM::Storage
477
377
  parameters.validate unless parameters.nil?
478
378
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
479
379
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
480
- # Construct URL
481
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}"
482
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
483
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
484
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
485
- url = URI.join(@client.base_url, path)
486
- properties = {}
487
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
488
- unless url.query.nil?
489
- url.query.split('&').each do |url_item|
490
- url_items_parts = url_item.split('=')
491
- properties[url_items_parts[0]] = url_items_parts[1]
492
- end
493
- end
494
- properties.reject!{ |key, value| value.nil? }
495
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
496
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
497
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
498
- url = URI.parse(corrected_url)
499
-
500
- connection = Faraday.new(:url => url) do |faraday|
501
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
502
- faraday.use :cookie_jar
503
- faraday.adapter Faraday.default_adapter
504
- end
505
- request_headers = Hash.new
380
+ request_headers = {}
506
381
 
507
382
  # Set Headers
508
383
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
509
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
510
-
511
- unless custom_headers.nil?
512
- custom_headers.each do |key, value|
513
- request_headers[key] = value
514
- end
515
- end
384
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
516
385
 
517
386
  # Serialize Request
518
- request_headers['Content-Type'] = 'application/json'
387
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
519
388
  unless parameters.nil?
520
389
  parameters = StorageAccountUpdateParameters.serialize_object(parameters)
521
390
  end
522
391
  request_content = JSON.generate(parameters, quirks_mode: true)
523
-
524
- # Send Request
525
- promise = Concurrent::Promise.new do
526
- connection.patch do |request|
527
- request.headers = request_headers
528
- request.body = request_content
529
- @client.credentials.sign_request(request) unless @client.credentials.nil?
530
- end
392
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}'
393
+ options = {
394
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
395
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
396
+ query_params: {'api-version' => @client.api_version},
397
+ body: request_content,
398
+ headers: request_headers.merge(custom_headers || {})
399
+ }
400
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :patch, options)
401
+ promise = request.run_promise do |req|
402
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
531
403
  end
532
404
 
533
405
  promise = promise.then do |http_response|
534
406
  status_code = http_response.status
535
407
  response_content = http_response.body
536
- unless (status_code == 200)
408
+ unless status_code == 200
537
409
  error_model = JSON.load(response_content)
538
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
410
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
539
411
  end
540
412
 
541
413
  # Create Result
542
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
414
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
543
415
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
544
416
  # Deserialize Response
545
417
  if status_code == 200
546
418
  begin
547
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
419
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
548
420
  unless parsed_response.nil?
549
421
  parsed_response = StorageAccount.deserialize_object(parsed_response)
550
422
  end
551
423
  result.body = parsed_response
552
424
  rescue Exception => e
553
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
425
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
554
426
  end
555
427
  end
556
428
 
@@ -562,6 +434,7 @@ module Azure::ARM::Storage
562
434
 
563
435
  #
564
436
  # Lists the access keys for the specified storage account.
437
+ #
565
438
  # @param resource_group_name [String] The name of the resource group.
566
439
  # @param account_name [String] The name of the storage account.
567
440
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -575,72 +448,44 @@ module Azure::ARM::Storage
575
448
  fail ArgumentError, 'account_name is nil' if account_name.nil?
576
449
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
577
450
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
578
- # Construct URL
579
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys"
580
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
581
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
582
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
583
- url = URI.join(@client.base_url, path)
584
- properties = {}
585
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
586
- unless url.query.nil?
587
- url.query.split('&').each do |url_item|
588
- url_items_parts = url_item.split('=')
589
- properties[url_items_parts[0]] = url_items_parts[1]
590
- end
591
- end
592
- properties.reject!{ |key, value| value.nil? }
593
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
594
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
595
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
596
- url = URI.parse(corrected_url)
597
-
598
- connection = Faraday.new(:url => url) do |faraday|
599
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
600
- faraday.use :cookie_jar
601
- faraday.adapter Faraday.default_adapter
602
- end
603
- request_headers = Hash.new
451
+ request_headers = {}
604
452
 
605
453
  # Set Headers
606
454
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
607
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
608
-
609
- unless custom_headers.nil?
610
- custom_headers.each do |key, value|
611
- request_headers[key] = value
612
- end
613
- end
614
-
615
- # Send Request
616
- promise = Concurrent::Promise.new do
617
- connection.post do |request|
618
- request.headers = request_headers
619
- @client.credentials.sign_request(request) unless @client.credentials.nil?
620
- end
455
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
456
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/listKeys'
457
+ options = {
458
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
459
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
460
+ query_params: {'api-version' => @client.api_version},
461
+ headers: request_headers.merge(custom_headers || {})
462
+ }
463
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
464
+ promise = request.run_promise do |req|
465
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
621
466
  end
622
467
 
623
468
  promise = promise.then do |http_response|
624
469
  status_code = http_response.status
625
470
  response_content = http_response.body
626
- unless (status_code == 200)
471
+ unless status_code == 200
627
472
  error_model = JSON.load(response_content)
628
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
473
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
629
474
  end
630
475
 
631
476
  # Create Result
632
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
477
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
633
478
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
634
479
  # Deserialize Response
635
480
  if status_code == 200
636
481
  begin
637
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
638
483
  unless parsed_response.nil?
639
484
  parsed_response = StorageAccountKeys.deserialize_object(parsed_response)
640
485
  end
641
486
  result.body = parsed_response
642
487
  rescue Exception => e
643
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
488
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
644
489
  end
645
490
  end
646
491
 
@@ -653,6 +498,7 @@ module Azure::ARM::Storage
653
498
  #
654
499
  # Lists all the storage accounts available under the subscription. Note that
655
500
  # storage keys are not returned; use the ListKeys operation for this.
501
+ #
656
502
  # @param [Hash{String => String}] The hash of custom headers need to be
657
503
  # applied to HTTP request.
658
504
  #
@@ -662,70 +508,44 @@ module Azure::ARM::Storage
662
508
  def list(custom_headers = nil)
663
509
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
664
510
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
665
- # Construct URL
666
- path = "/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts"
667
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
668
- url = URI.join(@client.base_url, path)
669
- properties = {}
670
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
671
- unless url.query.nil?
672
- url.query.split('&').each do |url_item|
673
- url_items_parts = url_item.split('=')
674
- properties[url_items_parts[0]] = url_items_parts[1]
675
- end
676
- end
677
- properties.reject!{ |key, value| value.nil? }
678
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
679
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
680
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
681
- url = URI.parse(corrected_url)
682
-
683
- connection = Faraday.new(:url => url) do |faraday|
684
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
685
- faraday.use :cookie_jar
686
- faraday.adapter Faraday.default_adapter
687
- end
688
- request_headers = Hash.new
511
+ request_headers = {}
689
512
 
690
513
  # Set Headers
691
514
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
692
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
693
-
694
- unless custom_headers.nil?
695
- custom_headers.each do |key, value|
696
- request_headers[key] = value
697
- end
698
- end
699
-
700
- # Send Request
701
- promise = Concurrent::Promise.new do
702
- connection.get do |request|
703
- request.headers = request_headers
704
- @client.credentials.sign_request(request) unless @client.credentials.nil?
705
- end
515
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
516
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Storage/storageAccounts'
517
+ options = {
518
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
519
+ path_params: {'subscriptionId' => @client.subscription_id},
520
+ query_params: {'api-version' => @client.api_version},
521
+ headers: request_headers.merge(custom_headers || {})
522
+ }
523
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
524
+ promise = request.run_promise do |req|
525
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
706
526
  end
707
527
 
708
528
  promise = promise.then do |http_response|
709
529
  status_code = http_response.status
710
530
  response_content = http_response.body
711
- unless (status_code == 200)
531
+ unless status_code == 200
712
532
  error_model = JSON.load(response_content)
713
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
533
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
714
534
  end
715
535
 
716
536
  # Create Result
717
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
537
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
718
538
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
719
539
  # Deserialize Response
720
540
  if status_code == 200
721
541
  begin
722
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
542
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
723
543
  unless parsed_response.nil?
724
544
  parsed_response = StorageAccountListResult.deserialize_object(parsed_response)
725
545
  end
726
546
  result.body = parsed_response
727
547
  rescue Exception => e
728
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
548
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
729
549
  end
730
550
  end
731
551
 
@@ -739,8 +559,9 @@ module Azure::ARM::Storage
739
559
  # Lists all the storage accounts available under the given resource group.
740
560
  # Note that storage keys are not returned; use the ListKeys operation for
741
561
  # this.
562
+ #
742
563
  # @param resource_group_name [String] The name of the resource group within
743
- # the user’s subscription.
564
+ # the user's subscription.
744
565
  # @param [Hash{String => String}] The hash of custom headers need to be
745
566
  # applied to HTTP request.
746
567
  #
@@ -751,71 +572,44 @@ module Azure::ARM::Storage
751
572
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
752
573
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
753
574
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
754
- # Construct URL
755
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts"
756
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
757
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
758
- url = URI.join(@client.base_url, path)
759
- properties = {}
760
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
761
- unless url.query.nil?
762
- url.query.split('&').each do |url_item|
763
- url_items_parts = url_item.split('=')
764
- properties[url_items_parts[0]] = url_items_parts[1]
765
- end
766
- end
767
- properties.reject!{ |key, value| value.nil? }
768
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
769
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
770
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
771
- url = URI.parse(corrected_url)
772
-
773
- connection = Faraday.new(:url => url) do |faraday|
774
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
775
- faraday.use :cookie_jar
776
- faraday.adapter Faraday.default_adapter
777
- end
778
- request_headers = Hash.new
575
+ request_headers = {}
779
576
 
780
577
  # Set Headers
781
578
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
782
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
783
-
784
- unless custom_headers.nil?
785
- custom_headers.each do |key, value|
786
- request_headers[key] = value
787
- end
788
- end
789
-
790
- # Send Request
791
- promise = Concurrent::Promise.new do
792
- connection.get do |request|
793
- request.headers = request_headers
794
- @client.credentials.sign_request(request) unless @client.credentials.nil?
795
- end
579
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
580
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts'
581
+ options = {
582
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
583
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
584
+ query_params: {'api-version' => @client.api_version},
585
+ headers: request_headers.merge(custom_headers || {})
586
+ }
587
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
588
+ promise = request.run_promise do |req|
589
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
796
590
  end
797
591
 
798
592
  promise = promise.then do |http_response|
799
593
  status_code = http_response.status
800
594
  response_content = http_response.body
801
- unless (status_code == 200)
595
+ unless status_code == 200
802
596
  error_model = JSON.load(response_content)
803
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
597
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
804
598
  end
805
599
 
806
600
  # Create Result
807
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
601
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
808
602
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
809
603
  # Deserialize Response
810
604
  if status_code == 200
811
605
  begin
812
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
606
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
813
607
  unless parsed_response.nil?
814
608
  parsed_response = StorageAccountListResult.deserialize_object(parsed_response)
815
609
  end
816
610
  result.body = parsed_response
817
611
  rescue Exception => e
818
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
612
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
819
613
  end
820
614
  end
821
615
 
@@ -827,13 +621,14 @@ module Azure::ARM::Storage
827
621
 
828
622
  #
829
623
  # Regenerates the access keys for the specified storage account.
624
+ #
830
625
  # @param resource_group_name [String] The name of the resource group within
831
- # the user’s subscription.
626
+ # the user's subscription.
832
627
  # @param account_name [String] The name of the storage account within the
833
628
  # specified resource group. Storage account names must be between 3 and 24
834
629
  # characters in length and use numbers and lower-case letters only.
835
630
  # @param regenerate_key [StorageAccountRegenerateKeyParameters] Specifies name
836
- # of the key which should be regenerated.
631
+ # of the key which should be regenerated. key1 or key2 for the default keys
837
632
  # @param [Hash{String => String}] The hash of custom headers need to be
838
633
  # applied to HTTP request.
839
634
  #
@@ -847,251 +642,52 @@ module Azure::ARM::Storage
847
642
  regenerate_key.validate unless regenerate_key.nil?
848
643
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
849
644
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
850
- # Construct URL
851
- path = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey"
852
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
853
- path['{accountName}'] = ERB::Util.url_encode(account_name) if path.include?('{accountName}')
854
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
855
- url = URI.join(@client.base_url, path)
856
- properties = {}
857
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
858
- unless url.query.nil?
859
- url.query.split('&').each do |url_item|
860
- url_items_parts = url_item.split('=')
861
- properties[url_items_parts[0]] = url_items_parts[1]
862
- end
863
- end
864
- properties.reject!{ |key, value| value.nil? }
865
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
866
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
867
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
868
- url = URI.parse(corrected_url)
869
-
870
- connection = Faraday.new(:url => url) do |faraday|
871
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
872
- faraday.use :cookie_jar
873
- faraday.adapter Faraday.default_adapter
874
- end
875
- request_headers = Hash.new
645
+ request_headers = {}
876
646
 
877
647
  # Set Headers
878
648
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
879
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
880
-
881
- unless custom_headers.nil?
882
- custom_headers.each do |key, value|
883
- request_headers[key] = value
884
- end
885
- end
649
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
886
650
 
887
651
  # Serialize Request
888
- request_headers['Content-Type'] = 'application/json'
652
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
889
653
  unless regenerate_key.nil?
890
654
  regenerate_key = StorageAccountRegenerateKeyParameters.serialize_object(regenerate_key)
891
655
  end
892
656
  request_content = JSON.generate(regenerate_key, quirks_mode: true)
893
-
894
- # Send Request
895
- promise = Concurrent::Promise.new do
896
- connection.post do |request|
897
- request.headers = request_headers
898
- request.body = request_content
899
- @client.credentials.sign_request(request) unless @client.credentials.nil?
900
- end
657
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/regenerateKey'
658
+ options = {
659
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
660
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
661
+ query_params: {'api-version' => @client.api_version},
662
+ body: request_content,
663
+ headers: request_headers.merge(custom_headers || {})
664
+ }
665
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
666
+ promise = request.run_promise do |req|
667
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
901
668
  end
902
669
 
903
670
  promise = promise.then do |http_response|
904
671
  status_code = http_response.status
905
672
  response_content = http_response.body
906
- unless (status_code == 200)
673
+ unless status_code == 200
907
674
  error_model = JSON.load(response_content)
908
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
675
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
909
676
  end
910
677
 
911
678
  # Create Result
912
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
679
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
913
680
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
914
681
  # Deserialize Response
915
682
  if status_code == 200
916
683
  begin
917
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
684
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
918
685
  unless parsed_response.nil?
919
686
  parsed_response = StorageAccountKeys.deserialize_object(parsed_response)
920
687
  end
921
688
  result.body = parsed_response
922
689
  rescue Exception => e
923
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
924
- end
925
- end
926
-
927
- result
928
- end
929
-
930
- promise.execute
931
- end
932
-
933
- #
934
- # Lists all the storage accounts available under the subscription. Note that
935
- # storage keys are not returned; use the ListKeys operation for this.
936
- # @param next_page_link [String] The NextLink from the previous successful
937
- # call to List operation.
938
- # @param [Hash{String => String}] The hash of custom headers need to be
939
- # applied to HTTP request.
940
- #
941
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
942
- # response.
943
- #
944
- def list_next(next_page_link, custom_headers = nil)
945
- fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
946
- # Construct URL
947
- path = "{nextLink}"
948
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
949
- url = URI.parse(path)
950
- properties = {}
951
- unless url.query.nil?
952
- url.query.split('&').each do |url_item|
953
- url_items_parts = url_item.split('=')
954
- properties[url_items_parts[0]] = url_items_parts[1]
955
- end
956
- end
957
- properties.reject!{ |key, value| value.nil? }
958
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
959
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
960
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
961
- url = URI.parse(corrected_url)
962
-
963
- connection = Faraday.new(:url => url) do |faraday|
964
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
965
- faraday.use :cookie_jar
966
- faraday.adapter Faraday.default_adapter
967
- end
968
- request_headers = Hash.new
969
-
970
- # Set Headers
971
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
972
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
973
-
974
- unless custom_headers.nil?
975
- custom_headers.each do |key, value|
976
- request_headers[key] = value
977
- end
978
- end
979
-
980
- # Send Request
981
- promise = Concurrent::Promise.new do
982
- connection.get do |request|
983
- request.headers = request_headers
984
- @client.credentials.sign_request(request) unless @client.credentials.nil?
985
- end
986
- end
987
-
988
- promise = promise.then do |http_response|
989
- status_code = http_response.status
990
- response_content = http_response.body
991
- unless (status_code == 200)
992
- error_model = JSON.load(response_content)
993
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
994
- end
995
-
996
- # Create Result
997
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
998
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
999
- # Deserialize Response
1000
- if status_code == 200
1001
- begin
1002
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
1003
- unless parsed_response.nil?
1004
- parsed_response = StorageAccountListResult.deserialize_object(parsed_response)
1005
- end
1006
- result.body = parsed_response
1007
- rescue Exception => e
1008
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
1009
- end
1010
- end
1011
-
1012
- result
1013
- end
1014
-
1015
- promise.execute
1016
- end
1017
-
1018
- #
1019
- # Lists all the storage accounts available under the given resource group.
1020
- # Note that storage keys are not returned; use the ListKeys operation for
1021
- # this.
1022
- # @param next_page_link [String] The NextLink from the previous successful
1023
- # call to List operation.
1024
- # @param [Hash{String => String}] The hash of custom headers need to be
1025
- # applied to HTTP request.
1026
- #
1027
- # @return [Concurrent::Promise] Promise object which allows to get HTTP
1028
- # response.
1029
- #
1030
- def list_by_resource_group_next(next_page_link, custom_headers = nil)
1031
- fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1032
- # Construct URL
1033
- path = "{nextLink}"
1034
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
1035
- url = URI.parse(path)
1036
- properties = {}
1037
- unless url.query.nil?
1038
- url.query.split('&').each do |url_item|
1039
- url_items_parts = url_item.split('=')
1040
- properties[url_items_parts[0]] = url_items_parts[1]
1041
- end
1042
- end
1043
- properties.reject!{ |key, value| value.nil? }
1044
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
1045
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
1046
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
1047
- url = URI.parse(corrected_url)
1048
-
1049
- connection = Faraday.new(:url => url) do |faraday|
1050
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
1051
- faraday.use :cookie_jar
1052
- faraday.adapter Faraday.default_adapter
1053
- end
1054
- request_headers = Hash.new
1055
-
1056
- # Set Headers
1057
- request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1058
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
1059
-
1060
- unless custom_headers.nil?
1061
- custom_headers.each do |key, value|
1062
- request_headers[key] = value
1063
- end
1064
- end
1065
-
1066
- # Send Request
1067
- promise = Concurrent::Promise.new do
1068
- connection.get do |request|
1069
- request.headers = request_headers
1070
- @client.credentials.sign_request(request) unless @client.credentials.nil?
1071
- end
1072
- end
1073
-
1074
- promise = promise.then do |http_response|
1075
- status_code = http_response.status
1076
- response_content = http_response.body
1077
- unless (status_code == 200)
1078
- error_model = JSON.load(response_content)
1079
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
1080
- end
1081
-
1082
- # Create Result
1083
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
1084
- result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1085
- # Deserialize Response
1086
- if status_code == 200
1087
- begin
1088
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
1089
- unless parsed_response.nil?
1090
- parsed_response = StorageAccountListResult.deserialize_object(parsed_response)
1091
- end
1092
- result.body = parsed_response
1093
- rescue Exception => e
1094
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
690
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1095
691
  end
1096
692
  end
1097
693