azure_mgmt_resources 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 (63) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_resources.gemspec +2 -7
  3. data/lib/azure_mgmt_resources.rb +21 -18
  4. data/lib/azure_mgmt_resources/deployment_operations.rb +54 -135
  5. data/lib/azure_mgmt_resources/deployments.rb +314 -305
  6. data/lib/azure_mgmt_resources/models/basic_dependency.rb +1 -3
  7. data/lib/azure_mgmt_resources/models/dependency.rb +4 -6
  8. data/lib/azure_mgmt_resources/models/deployment.rb +1 -3
  9. data/lib/azure_mgmt_resources/models/deployment_extended.rb +8 -9
  10. data/lib/azure_mgmt_resources/models/deployment_extended_filter.rb +1 -3
  11. data/lib/azure_mgmt_resources/models/deployment_list_result.rb +4 -6
  12. data/lib/azure_mgmt_resources/models/deployment_mode.rb +2 -1
  13. data/lib/azure_mgmt_resources/models/deployment_operation.rb +1 -3
  14. data/lib/azure_mgmt_resources/models/deployment_operation_properties.rb +1 -3
  15. data/lib/azure_mgmt_resources/models/deployment_operations_list_result.rb +4 -6
  16. data/lib/azure_mgmt_resources/models/deployment_properties.rb +3 -5
  17. data/lib/azure_mgmt_resources/models/deployment_properties_extended.rb +9 -11
  18. data/lib/azure_mgmt_resources/models/deployment_validate_result.rb +1 -3
  19. data/lib/azure_mgmt_resources/models/generic_resource.rb +1 -3
  20. data/lib/azure_mgmt_resources/models/generic_resource_filter.rb +1 -3
  21. data/lib/azure_mgmt_resources/models/parameters_link.rb +2 -4
  22. data/lib/azure_mgmt_resources/models/plan.rb +1 -3
  23. data/lib/azure_mgmt_resources/models/policy_assignment.rb +72 -0
  24. data/lib/azure_mgmt_resources/models/policy_assignment_list_result.rb +86 -0
  25. data/lib/azure_mgmt_resources/models/policy_assignment_properties.rb +74 -0
  26. data/lib/azure_mgmt_resources/models/policy_definition.rb +72 -0
  27. data/lib/azure_mgmt_resources/models/policy_definition_properties.rb +74 -0
  28. data/lib/azure_mgmt_resources/models/provider.rb +4 -6
  29. data/lib/azure_mgmt_resources/models/provider_list_result.rb +4 -6
  30. data/lib/azure_mgmt_resources/models/provider_resource_type.rb +1 -3
  31. data/lib/azure_mgmt_resources/models/resource_group.rb +8 -9
  32. data/lib/azure_mgmt_resources/models/resource_group_filter.rb +1 -3
  33. data/lib/azure_mgmt_resources/models/resource_group_list_result.rb +11 -12
  34. data/lib/azure_mgmt_resources/models/resource_group_properties.rb +1 -3
  35. data/lib/azure_mgmt_resources/models/resource_list_result.rb +11 -12
  36. data/lib/azure_mgmt_resources/models/resource_management_error.rb +3 -4
  37. data/lib/azure_mgmt_resources/models/resource_management_error_with_details.rb +23 -35
  38. data/lib/azure_mgmt_resources/models/resource_provider_operation_definition.rb +1 -3
  39. data/lib/azure_mgmt_resources/models/resource_provider_operation_detail_list_result.rb +4 -6
  40. data/lib/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -3
  41. data/lib/azure_mgmt_resources/models/resources_move_info.rb +1 -3
  42. data/lib/azure_mgmt_resources/models/tag_count.rb +1 -3
  43. data/lib/azure_mgmt_resources/models/tag_details.rb +4 -6
  44. data/lib/azure_mgmt_resources/models/tag_value.rb +1 -3
  45. data/lib/azure_mgmt_resources/models/tags_list_result.rb +11 -12
  46. data/lib/azure_mgmt_resources/models/target_resource.rb +1 -3
  47. data/lib/azure_mgmt_resources/models/template_link.rb +2 -4
  48. data/lib/azure_mgmt_resources/module_definition.rb +5 -3
  49. data/lib/azure_mgmt_resources/policy_assignments.rb +922 -0
  50. data/lib/azure_mgmt_resources/policy_definitions.rb +208 -0
  51. data/lib/azure_mgmt_resources/providers.rb +90 -219
  52. data/lib/azure_mgmt_resources/resource_groups.rb +166 -434
  53. data/lib/azure_mgmt_resources/resource_management_client.rb +25 -10
  54. data/lib/azure_mgmt_resources/resource_provider_operation_details.rb +88 -43
  55. data/lib/azure_mgmt_resources/resources.rb +162 -366
  56. data/lib/azure_mgmt_resources/tags.rb +110 -264
  57. data/lib/azure_mgmt_resources/version.rb +5 -3
  58. metadata +12 -86
  59. data/.travis.yml +0 -3
  60. data/Gemfile +0 -14
  61. data/lib/azure_mgmt_resources/models/resource_group_extended.rb +0 -113
  62. data/lib/azure_mgmt_resources/models/resource_group_extended_filter.rb +0 -63
  63. data/lib/azure_mgmt_resources/models/resource_group_format_resource_properties.rb +0 -54
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08101b1e3f9ecdbd149bdce649dd7edf4b91aa11
4
- data.tar.gz: e90f1940d2775b57caafd391a1c7e8a848bc7ee9
3
+ metadata.gz: 7af282d525651ef1639345a52a475351a43b278b
4
+ data.tar.gz: 8f86b9e908f1ce9d3ab0e6bb219252fce19cf758
5
5
  SHA512:
6
- metadata.gz: 60bf99ba7655d99da0f58ceeec5da9c20a2c743cc0c7f5ead861b06299761c497198e845b0659136664b1deb724a921c504b5412d520c72684d0690fc8886c27
7
- data.tar.gz: 0e295c21234e9da43a5ad7bbf91f308b48e4165aceb5e852f7bc3ee7c610b9706f04fb4b25a64b85249c41d61265243f8fc759e7666e52ca58b455dd7443e827
6
+ metadata.gz: 8143575e341f70f3b12cfcf4613390f61beb872da8e99ac230d81d7216963d61deb60bfac4cb6a8d35d36101b235e854ebf7daa5a1b7ef95f29f1e009afd7def
7
+ data.tar.gz: 6cef3fdbc40d9723a3cbc143a3d09c26b38b248f8cf3a5e4e5f1cfeabd08e274f42d94cfe501893361d31b5b03cebe8d99dd9f0fb53df4fa3a83dd9773f90b0a
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.name = 'azure_mgmt_resources'
13
13
  spec.version = Azure::ARM::Resources::VERSION
14
14
  spec.authors = 'Microsoft Corporation'
15
- spec.email = 'azsdkteam@microsoft.com'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
16
  spec.description = 'Microsoft Azure Resource Management Client Library for Ruby'
17
17
  spec.summary = 'Official ruby client library to consume Microsoft Azure Resource Management services.'
18
18
  spec.homepage = 'http://github.com/azure/azure-sdk-for-ruby'
@@ -30,10 +30,5 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency 'rspec', '~> 3'
31
31
  spec.add_development_dependency 'dotenv', '~> 2'
32
32
 
33
- spec.add_runtime_dependency 'json', '~> 1.8'
34
- spec.add_runtime_dependency 'concurrent-ruby', ['>= 1.0.0.pre1', '<2']
35
- spec.add_runtime_dependency 'faraday', '~> 0.9'
36
- spec.add_runtime_dependency 'faraday-cookie_jar', '~> 0.0.6'
37
- spec.add_runtime_dependency 'ms_rest_azure', '~> 0.1.0'
38
- spec.add_runtime_dependency 'ms_rest', '~> 0.1.0'
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.2.0'
39
34
  end
@@ -1,9 +1,8 @@
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
-
7
6
  require 'uri'
8
7
  require 'cgi'
9
8
  require 'date'
@@ -19,30 +18,45 @@ require 'concurrent'
19
18
  require 'ms_rest'
20
19
  require 'ms_rest_azure'
21
20
 
22
- require 'azure_mgmt_resources/module_definition'
23
- require 'azure_mgmt_resources/version'
24
-
25
21
  module Azure::ARM::Resources
22
+ autoload :Deployments, 'azure_mgmt_resources/deployments.rb'
26
23
  autoload :Providers, 'azure_mgmt_resources/providers.rb'
27
24
  autoload :ResourceGroups, 'azure_mgmt_resources/resource_groups.rb'
28
25
  autoload :Resources, 'azure_mgmt_resources/resources.rb'
29
26
  autoload :Tags, 'azure_mgmt_resources/tags.rb'
30
27
  autoload :DeploymentOperations, 'azure_mgmt_resources/deployment_operations.rb'
31
28
  autoload :ResourceProviderOperationDetails, 'azure_mgmt_resources/resource_provider_operation_details.rb'
32
- autoload :Deployments, 'azure_mgmt_resources/deployments.rb'
29
+ autoload :PolicyDefinitions, 'azure_mgmt_resources/policy_definitions.rb'
30
+ autoload :PolicyAssignments, 'azure_mgmt_resources/policy_assignments.rb'
33
31
  autoload :ResourceManagementClient, 'azure_mgmt_resources/resource_management_client.rb'
34
32
 
35
33
  module Models
34
+ autoload :PolicyAssignmentProperties, 'azure_mgmt_resources/models/policy_assignment_properties.rb'
35
+ autoload :PolicyAssignment, 'azure_mgmt_resources/models/policy_assignment.rb'
36
+ autoload :PolicyAssignmentListResult, 'azure_mgmt_resources/models/policy_assignment_list_result.rb'
37
+ autoload :PolicyDefinitionProperties, 'azure_mgmt_resources/models/policy_definition_properties.rb'
38
+ autoload :PolicyDefinition, 'azure_mgmt_resources/models/policy_definition.rb'
36
39
  autoload :DeploymentExtendedFilter, 'azure_mgmt_resources/models/deployment_extended_filter.rb'
37
40
  autoload :GenericResourceFilter, 'azure_mgmt_resources/models/generic_resource_filter.rb'
38
41
  autoload :ResourceGroupFilter, 'azure_mgmt_resources/models/resource_group_filter.rb'
42
+ autoload :TemplateLink, 'azure_mgmt_resources/models/template_link.rb'
43
+ autoload :ParametersLink, 'azure_mgmt_resources/models/parameters_link.rb'
44
+ autoload :DeploymentProperties, 'azure_mgmt_resources/models/deployment_properties.rb'
45
+ autoload :Deployment, 'azure_mgmt_resources/models/deployment.rb'
46
+ autoload :ResourceManagementError, 'azure_mgmt_resources/models/resource_management_error.rb'
39
47
  autoload :ProviderResourceType, 'azure_mgmt_resources/models/provider_resource_type.rb'
40
48
  autoload :Provider, 'azure_mgmt_resources/models/provider.rb'
49
+ autoload :BasicDependency, 'azure_mgmt_resources/models/basic_dependency.rb'
50
+ autoload :Dependency, 'azure_mgmt_resources/models/dependency.rb'
51
+ autoload :DeploymentPropertiesExtended, 'azure_mgmt_resources/models/deployment_properties_extended.rb'
52
+ autoload :DeploymentValidateResult, 'azure_mgmt_resources/models/deployment_validate_result.rb'
53
+ autoload :DeploymentExtended, 'azure_mgmt_resources/models/deployment_extended.rb'
54
+ autoload :DeploymentListResult, 'azure_mgmt_resources/models/deployment_list_result.rb'
41
55
  autoload :ProviderListResult, 'azure_mgmt_resources/models/provider_list_result.rb'
42
56
  autoload :Plan, 'azure_mgmt_resources/models/plan.rb'
43
57
  autoload :ResourceListResult, 'azure_mgmt_resources/models/resource_list_result.rb'
44
- autoload :ResourceGroupProperties, 'azure_mgmt_resources/models/resource_group_properties.rb'
45
58
  autoload :ResourceGroup, 'azure_mgmt_resources/models/resource_group.rb'
59
+ autoload :ResourceGroupProperties, 'azure_mgmt_resources/models/resource_group_properties.rb'
46
60
  autoload :ResourceGroupListResult, 'azure_mgmt_resources/models/resource_group_list_result.rb'
47
61
  autoload :ResourcesMoveInfo, 'azure_mgmt_resources/models/resources_move_info.rb'
48
62
  autoload :TagCount, 'azure_mgmt_resources/models/tag_count.rb'
@@ -56,18 +70,7 @@ module Azure::ARM::Resources
56
70
  autoload :ResourceProviderOperationDisplayProperties, 'azure_mgmt_resources/models/resource_provider_operation_display_properties.rb'
57
71
  autoload :ResourceProviderOperationDefinition, 'azure_mgmt_resources/models/resource_provider_operation_definition.rb'
58
72
  autoload :ResourceProviderOperationDetailListResult, 'azure_mgmt_resources/models/resource_provider_operation_detail_list_result.rb'
59
- autoload :TemplateLink, 'azure_mgmt_resources/models/template_link.rb'
60
- autoload :ParametersLink, 'azure_mgmt_resources/models/parameters_link.rb'
61
- autoload :DeploymentProperties, 'azure_mgmt_resources/models/deployment_properties.rb'
62
- autoload :Deployment, 'azure_mgmt_resources/models/deployment.rb'
63
- autoload :ResourceManagementError, 'azure_mgmt_resources/models/resource_management_error.rb'
64
73
  autoload :ResourceManagementErrorWithDetails, 'azure_mgmt_resources/models/resource_management_error_with_details.rb'
65
- autoload :BasicDependency, 'azure_mgmt_resources/models/basic_dependency.rb'
66
- autoload :Dependency, 'azure_mgmt_resources/models/dependency.rb'
67
- autoload :DeploymentPropertiesExtended, 'azure_mgmt_resources/models/deployment_properties_extended.rb'
68
- autoload :DeploymentValidateResult, 'azure_mgmt_resources/models/deployment_validate_result.rb'
69
- autoload :DeploymentExtended, 'azure_mgmt_resources/models/deployment_extended.rb'
70
- autoload :DeploymentListResult, 'azure_mgmt_resources/models/deployment_list_result.rb'
71
74
  autoload :GenericResource, 'azure_mgmt_resources/models/generic_resource.rb'
72
75
  autoload :DeploymentMode, 'azure_mgmt_resources/models/deployment_mode.rb'
73
76
  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
 
@@ -24,6 +24,7 @@ module Azure::ARM::Resources
24
24
 
25
25
  #
26
26
  # Get a list of deployments operations.
27
+ #
27
28
  # @param resource_group_name [String] The name of the resource group. The name
28
29
  # is case insensitive.
29
30
  # @param deployment_name [String] The name of the deployment.
@@ -40,73 +41,44 @@ module Azure::ARM::Resources
40
41
  fail ArgumentError, 'operation_id is nil' if operation_id.nil?
41
42
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
42
43
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
43
- # Construct URL
44
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}"
45
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
46
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
47
- path['{operationId}'] = ERB::Util.url_encode(operation_id) if path.include?('{operationId}')
48
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
49
- url = URI.join(@client.base_url, path)
50
- properties = {}
51
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
52
- unless url.query.nil?
53
- url.query.split('&').each do |url_item|
54
- url_items_parts = url_item.split('=')
55
- properties[url_items_parts[0]] = url_items_parts[1]
56
- end
57
- end
58
- properties.reject!{ |key, value| value.nil? }
59
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
60
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
61
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
62
- url = URI.parse(corrected_url)
63
-
64
- connection = Faraday.new(:url => url) do |faraday|
65
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
66
- faraday.use :cookie_jar
67
- faraday.adapter Faraday.default_adapter
68
- end
69
- request_headers = Hash.new
44
+ request_headers = {}
70
45
 
71
46
  # Set Headers
72
47
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
73
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
74
-
75
- unless custom_headers.nil?
76
- custom_headers.each do |key, value|
77
- request_headers[key] = value
78
- end
79
- end
80
-
81
- # Send Request
82
- promise = Concurrent::Promise.new do
83
- connection.get do |request|
84
- request.headers = request_headers
85
- @client.credentials.sign_request(request) unless @client.credentials.nil?
86
- end
48
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
49
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}'
50
+ options = {
51
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
52
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'operationId' => operation_id,'subscriptionId' => @client.subscription_id},
53
+ query_params: {'api-version' => @client.api_version},
54
+ headers: request_headers.merge(custom_headers || {})
55
+ }
56
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
57
+ promise = request.run_promise do |req|
58
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
87
59
  end
88
60
 
89
61
  promise = promise.then do |http_response|
90
62
  status_code = http_response.status
91
63
  response_content = http_response.body
92
- unless (status_code == 200)
64
+ unless status_code == 200
93
65
  error_model = JSON.load(response_content)
94
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
66
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
95
67
  end
96
68
 
97
69
  # Create Result
98
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
70
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
99
71
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
100
72
  # Deserialize Response
101
73
  if status_code == 200
102
74
  begin
103
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
75
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
104
76
  unless parsed_response.nil?
105
77
  parsed_response = DeploymentOperation.deserialize_object(parsed_response)
106
78
  end
107
79
  result.body = parsed_response
108
80
  rescue Exception => e
109
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
81
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
110
82
  end
111
83
  end
112
84
 
@@ -118,6 +90,7 @@ module Azure::ARM::Resources
118
90
 
119
91
  #
120
92
  # Gets a list of deployments operations.
93
+ #
121
94
  # @param resource_group_name [String] The name of the resource group. The name
122
95
  # is case insensitive.
123
96
  # @param deployment_name [String] The name of the deployment.
@@ -133,73 +106,44 @@ module Azure::ARM::Resources
133
106
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
134
107
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
135
108
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
136
- # Construct URL
137
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations"
138
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
139
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
140
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
141
- url = URI.join(@client.base_url, path)
142
- properties = {}
143
- properties['$top'] = ERB::Util.url_encode(top.to_s) unless top.nil?
144
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
145
- unless url.query.nil?
146
- url.query.split('&').each do |url_item|
147
- url_items_parts = url_item.split('=')
148
- properties[url_items_parts[0]] = url_items_parts[1]
149
- end
150
- end
151
- properties.reject!{ |key, value| value.nil? }
152
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
153
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
154
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
155
- url = URI.parse(corrected_url)
156
-
157
- connection = Faraday.new(:url => url) do |faraday|
158
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
159
- faraday.use :cookie_jar
160
- faraday.adapter Faraday.default_adapter
161
- end
162
- request_headers = Hash.new
109
+ request_headers = {}
163
110
 
164
111
  # Set Headers
165
112
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
166
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
167
-
168
- unless custom_headers.nil?
169
- custom_headers.each do |key, value|
170
- request_headers[key] = value
171
- end
172
- end
173
-
174
- # Send Request
175
- promise = Concurrent::Promise.new do
176
- connection.get do |request|
177
- request.headers = request_headers
178
- @client.credentials.sign_request(request) unless @client.credentials.nil?
179
- end
113
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
114
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations'
115
+ options = {
116
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
117
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
118
+ query_params: {'$top' => top,'api-version' => @client.api_version},
119
+ headers: request_headers.merge(custom_headers || {})
120
+ }
121
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
122
+ promise = request.run_promise do |req|
123
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
180
124
  end
181
125
 
182
126
  promise = promise.then do |http_response|
183
127
  status_code = http_response.status
184
128
  response_content = http_response.body
185
- unless (status_code == 200)
129
+ unless status_code == 200
186
130
  error_model = JSON.load(response_content)
187
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
131
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
188
132
  end
189
133
 
190
134
  # Create Result
191
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
135
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
192
136
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
193
137
  # Deserialize Response
194
138
  if status_code == 200
195
139
  begin
196
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
197
141
  unless parsed_response.nil?
198
142
  parsed_response = DeploymentOperationsListResult.deserialize_object(parsed_response)
199
143
  end
200
144
  result.body = parsed_response
201
145
  rescue Exception => e
202
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
146
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
203
147
  end
204
148
  end
205
149
 
@@ -211,6 +155,7 @@ module Azure::ARM::Resources
211
155
 
212
156
  #
213
157
  # Gets a list of deployments operations.
158
+ #
214
159
  # @param next_page_link [String] The NextLink from the previous successful
215
160
  # call to List operation.
216
161
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -221,69 +166,43 @@ module Azure::ARM::Resources
221
166
  #
222
167
  def list_next(next_page_link, custom_headers = nil)
223
168
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
224
- # Construct URL
225
- path = "{nextLink}"
226
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
227
- url = URI.parse(path)
228
- properties = {}
229
- unless url.query.nil?
230
- url.query.split('&').each do |url_item|
231
- url_items_parts = url_item.split('=')
232
- properties[url_items_parts[0]] = url_items_parts[1]
233
- end
234
- end
235
- properties.reject!{ |key, value| value.nil? }
236
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
237
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
238
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
239
- url = URI.parse(corrected_url)
240
-
241
- connection = Faraday.new(:url => url) do |faraday|
242
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
243
- faraday.use :cookie_jar
244
- faraday.adapter Faraday.default_adapter
245
- end
246
- request_headers = Hash.new
169
+ request_headers = {}
247
170
 
248
171
  # Set Headers
249
172
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
250
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
251
-
252
- unless custom_headers.nil?
253
- custom_headers.each do |key, value|
254
- request_headers[key] = value
255
- end
256
- end
257
-
258
- # Send Request
259
- promise = Concurrent::Promise.new do
260
- connection.get do |request|
261
- request.headers = request_headers
262
- @client.credentials.sign_request(request) unless @client.credentials.nil?
263
- end
173
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
174
+ path_template = '{nextLink}'
175
+ options = {
176
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
177
+ skip_encoding_path_params: {'nextLink' => next_page_link},
178
+ headers: request_headers.merge(custom_headers || {})
179
+ }
180
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
181
+ promise = request.run_promise do |req|
182
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
264
183
  end
265
184
 
266
185
  promise = promise.then do |http_response|
267
186
  status_code = http_response.status
268
187
  response_content = http_response.body
269
- unless (status_code == 200)
188
+ unless status_code == 200
270
189
  error_model = JSON.load(response_content)
271
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
190
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
272
191
  end
273
192
 
274
193
  # Create Result
275
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
194
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
276
195
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
277
196
  # Deserialize Response
278
197
  if status_code == 200
279
198
  begin
280
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
199
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
281
200
  unless parsed_response.nil?
282
201
  parsed_response = DeploymentOperationsListResult.deserialize_object(parsed_response)
283
202
  end
284
203
  result.body = parsed_response
285
204
  rescue Exception => e
286
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
205
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
287
206
  end
288
207
  end
289
208
 
@@ -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
 
@@ -23,75 +23,129 @@ module Azure::ARM::Resources
23
23
  attr_reader :client
24
24
 
25
25
  #
26
- # Cancel a currently running template deployment.
26
+ # Begin deleting deployment.To determine whether the operation has finished
27
+ # processing the request, call GetLongRunningOperationStatus.
28
+ #
27
29
  # @param resource_group_name [String] The name of the resource group. The name
28
30
  # is case insensitive.
29
- # @param deployment_name [String] The name of the deployment.
31
+ # @param deployment_name [String] The name of the deployment to be deleted.
32
+ # @return [Concurrent::Promise] promise which provides async access to http
33
+ # response.
34
+ #
35
+ def delete(resource_group_name, deployment_name, custom_headers = nil)
36
+ # Send request
37
+ promise = begin_delete(resource_group_name, deployment_name, custom_headers)
38
+
39
+ promise = promise.then do |response|
40
+ # Defining deserialization method.
41
+ deserialize_method = lambda do |parsed_response|
42
+ end
43
+
44
+ # Waiting for response.
45
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
46
+ end
47
+
48
+ promise
49
+ end
50
+
51
+ #
52
+ # Begin deleting deployment.To determine whether the operation has finished
53
+ # processing the request, call GetLongRunningOperationStatus.
54
+ #
55
+ # @param resource_group_name [String] The name of the resource group. The name
56
+ # is case insensitive.
57
+ # @param deployment_name [String] The name of the deployment to be deleted.
30
58
  # @param [Hash{String => String}] The hash of custom headers need to be
31
59
  # applied to HTTP request.
32
60
  #
33
61
  # @return [Concurrent::Promise] Promise object which allows to get HTTP
34
62
  # response.
35
63
  #
36
- def cancel(resource_group_name, deployment_name, custom_headers = nil)
64
+ def begin_delete(resource_group_name, deployment_name, custom_headers = nil)
37
65
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
38
66
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
39
67
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
40
68
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
41
- # Construct URL
42
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/cancel"
43
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
44
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
45
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
46
- url = URI.join(@client.base_url, path)
47
- properties = {}
48
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
49
- unless url.query.nil?
50
- url.query.split('&').each do |url_item|
51
- url_items_parts = url_item.split('=')
52
- properties[url_items_parts[0]] = url_items_parts[1]
53
- end
54
- end
55
- properties.reject!{ |key, value| value.nil? }
56
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
57
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
58
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
59
- url = URI.parse(corrected_url)
60
-
61
- connection = Faraday.new(:url => url) do |faraday|
62
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
63
- faraday.use :cookie_jar
64
- faraday.adapter Faraday.default_adapter
65
- end
66
- request_headers = Hash.new
69
+ request_headers = {}
67
70
 
68
71
  # Set Headers
69
72
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
70
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
73
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
74
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
75
+ options = {
76
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
77
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
78
+ query_params: {'api-version' => @client.api_version},
79
+ headers: request_headers.merge(custom_headers || {})
80
+ }
81
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
82
+ promise = request.run_promise do |req|
83
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
84
+ end
71
85
 
72
- unless custom_headers.nil?
73
- custom_headers.each do |key, value|
74
- request_headers[key] = value
86
+ promise = promise.then do |http_response|
87
+ status_code = http_response.status
88
+ response_content = http_response.body
89
+ unless status_code == 202 || status_code == 204
90
+ error_model = JSON.load(response_content)
91
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
75
92
  end
93
+
94
+ # Create Result
95
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
96
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
97
+
98
+ result
76
99
  end
77
100
 
78
- # Send Request
79
- promise = Concurrent::Promise.new do
80
- connection.post do |request|
81
- request.headers = request_headers
82
- @client.credentials.sign_request(request) unless @client.credentials.nil?
83
- end
101
+ promise.execute
102
+ end
103
+
104
+ #
105
+ # Checks whether deployment exists.
106
+ #
107
+ # @param resource_group_name [String] The name of the resource group to check.
108
+ # The name is case insensitive.
109
+ # @param deployment_name [String] The name of the deployment.
110
+ # @param [Hash{String => String}] The hash of custom headers need to be
111
+ # applied to HTTP request.
112
+ #
113
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
114
+ # response.
115
+ #
116
+ def check_existence(resource_group_name, deployment_name, custom_headers = nil)
117
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
118
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
119
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
120
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
121
+ request_headers = {}
122
+
123
+ # Set Headers
124
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
125
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
126
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
127
+ options = {
128
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
129
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
130
+ query_params: {'api-version' => @client.api_version},
131
+ headers: request_headers.merge(custom_headers || {})
132
+ }
133
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :head, options)
134
+ promise = request.run_promise do |req|
135
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
84
136
  end
85
137
 
86
138
  promise = promise.then do |http_response|
87
139
  status_code = http_response.status
88
140
  response_content = http_response.body
89
- unless (status_code == 204)
90
- fail MsRestAzure::AzureOperationError.new(connection, http_response)
141
+ unless status_code == 204 || status_code == 404
142
+ error_model = JSON.load(response_content)
143
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
91
144
  end
92
145
 
93
146
  # Create Result
94
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
147
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
148
+ result.body = (status_code == 204)
95
149
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
96
150
 
97
151
  result
@@ -101,110 +155,121 @@ module Azure::ARM::Resources
101
155
  end
102
156
 
103
157
  #
104
- # Validate a deployment template.
158
+ # Create a named template deployment using a template.
159
+ #
105
160
  # @param resource_group_name [String] The name of the resource group. The name
106
161
  # is case insensitive.
107
162
  # @param deployment_name [String] The name of the deployment.
108
- # @param parameters [Deployment] Deployment to validate.
163
+ # @param parameters [Deployment] Additional parameters supplied to the
164
+ # operation.
165
+ # @param @client.api_version [String] Client Api Version.
166
+ # @param @client.subscription_id [String] Gets subscription credentials which
167
+ # uniquely identify Microsoft Azure subscription. The subscription ID forms
168
+ # part of the URI for every service call.
169
+ # @param @client.accept_language [String] Gets or sets the preferred language
170
+ # for the response.
171
+ #
172
+ # @return [Concurrent::Promise] promise which provides async access to http
173
+ # response.
174
+ #
175
+ def create_or_update(resource_group_name, deployment_name, parameters, custom_headers = nil)
176
+ # Send request
177
+ promise = begin_create_or_update(resource_group_name, deployment_name, parameters, custom_headers)
178
+
179
+ promise = promise.then do |response|
180
+ # Defining deserialization method.
181
+ deserialize_method = lambda do |parsed_response|
182
+ unless parsed_response.nil?
183
+ parsed_response = DeploymentExtended.deserialize_object(parsed_response)
184
+ end
185
+ end
186
+
187
+ # Waiting for response.
188
+ @client.get_put_operation_result(response, deserialize_method)
189
+ end
190
+
191
+ promise
192
+ end
193
+
194
+ #
195
+ # Create a named template deployment using a template.
196
+ #
197
+ # @param resource_group_name [String] The name of the resource group. The name
198
+ # is case insensitive.
199
+ # @param deployment_name [String] The name of the deployment.
200
+ # @param parameters [Deployment] Additional parameters supplied to the
201
+ # operation.
109
202
  # @param [Hash{String => String}] The hash of custom headers need to be
110
203
  # applied to HTTP request.
111
204
  #
112
205
  # @return [Concurrent::Promise] Promise object which allows to get HTTP
113
206
  # response.
114
207
  #
115
- def validate(resource_group_name, deployment_name, parameters, custom_headers = nil)
208
+ def begin_create_or_update(resource_group_name, deployment_name, parameters, custom_headers = nil)
116
209
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
117
210
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
118
211
  fail ArgumentError, 'parameters is nil' if parameters.nil?
119
212
  parameters.validate unless parameters.nil?
120
213
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
121
214
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
122
- # Construct URL
123
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.resources/deployments/{deploymentName}/validate"
124
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
125
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
126
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
127
- url = URI.join(@client.base_url, path)
128
- properties = {}
129
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
130
- unless url.query.nil?
131
- url.query.split('&').each do |url_item|
132
- url_items_parts = url_item.split('=')
133
- properties[url_items_parts[0]] = url_items_parts[1]
134
- end
135
- end
136
- properties.reject!{ |key, value| value.nil? }
137
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
138
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
139
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
140
- url = URI.parse(corrected_url)
141
-
142
- connection = Faraday.new(:url => url) do |faraday|
143
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
144
- faraday.use :cookie_jar
145
- faraday.adapter Faraday.default_adapter
146
- end
147
- request_headers = Hash.new
215
+ request_headers = {}
148
216
 
149
217
  # Set Headers
150
218
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
151
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
152
-
153
- unless custom_headers.nil?
154
- custom_headers.each do |key, value|
155
- request_headers[key] = value
156
- end
157
- end
219
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
158
220
 
159
221
  # Serialize Request
160
- request_headers['Content-Type'] = 'application/json'
222
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
161
223
  unless parameters.nil?
162
224
  parameters = Deployment.serialize_object(parameters)
163
225
  end
164
226
  request_content = JSON.generate(parameters, quirks_mode: true)
165
-
166
- # Send Request
167
- promise = Concurrent::Promise.new do
168
- connection.post do |request|
169
- request.headers = request_headers
170
- request.body = request_content
171
- @client.credentials.sign_request(request) unless @client.credentials.nil?
172
- end
227
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
228
+ options = {
229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
230
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
231
+ query_params: {'api-version' => @client.api_version},
232
+ body: request_content,
233
+ headers: request_headers.merge(custom_headers || {})
234
+ }
235
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
236
+ promise = request.run_promise do |req|
237
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
173
238
  end
174
239
 
175
240
  promise = promise.then do |http_response|
176
241
  status_code = http_response.status
177
242
  response_content = http_response.body
178
- unless (status_code == 200 || status_code == 400)
243
+ unless status_code == 200 || status_code == 201
179
244
  error_model = JSON.load(response_content)
180
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
245
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
181
246
  end
182
247
 
183
248
  # Create Result
184
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
249
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
185
250
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
186
251
  # Deserialize Response
187
252
  if status_code == 200
188
253
  begin
189
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
254
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
190
255
  unless parsed_response.nil?
191
- parsed_response = DeploymentValidateResult.deserialize_object(parsed_response)
256
+ parsed_response = DeploymentExtended.deserialize_object(parsed_response)
192
257
  end
193
258
  result.body = parsed_response
194
259
  rescue Exception => e
195
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
260
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
196
261
  end
197
262
  end
198
263
  # Deserialize Response
199
- if status_code == 400
264
+ if status_code == 201
200
265
  begin
201
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
266
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
202
267
  unless parsed_response.nil?
203
- parsed_response = DeploymentValidateResult.deserialize_object(parsed_response)
268
+ parsed_response = DeploymentExtended.deserialize_object(parsed_response)
204
269
  end
205
270
  result.body = parsed_response
206
271
  rescue Exception => e
207
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
272
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
208
273
  end
209
274
  end
210
275
 
@@ -215,111 +280,60 @@ module Azure::ARM::Resources
215
280
  end
216
281
 
217
282
  #
218
- # Create a named template deployment using a template.
219
- # @param resource_group_name [String] The name of the resource group. The name
220
- # is case insensitive.
283
+ # Get a deployment.
284
+ #
285
+ # @param resource_group_name [String] The name of the resource group to get.
286
+ # The name is case insensitive.
221
287
  # @param deployment_name [String] The name of the deployment.
222
- # @param parameters [Deployment] Additional parameters supplied to the
223
- # operation.
224
288
  # @param [Hash{String => String}] The hash of custom headers need to be
225
289
  # applied to HTTP request.
226
290
  #
227
291
  # @return [Concurrent::Promise] Promise object which allows to get HTTP
228
292
  # response.
229
293
  #
230
- def create_or_update(resource_group_name, deployment_name, parameters, custom_headers = nil)
294
+ def get(resource_group_name, deployment_name, custom_headers = nil)
231
295
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
232
296
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
233
- fail ArgumentError, 'parameters is nil' if parameters.nil?
234
- parameters.validate unless parameters.nil?
235
297
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
236
298
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
237
- # Construct URL
238
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}"
239
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
240
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
241
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
242
- url = URI.join(@client.base_url, path)
243
- properties = {}
244
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
245
- unless url.query.nil?
246
- url.query.split('&').each do |url_item|
247
- url_items_parts = url_item.split('=')
248
- properties[url_items_parts[0]] = url_items_parts[1]
249
- end
250
- end
251
- properties.reject!{ |key, value| value.nil? }
252
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
253
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
254
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
255
- url = URI.parse(corrected_url)
256
-
257
- connection = Faraday.new(:url => url) do |faraday|
258
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
259
- faraday.use :cookie_jar
260
- faraday.adapter Faraday.default_adapter
261
- end
262
- request_headers = Hash.new
299
+ request_headers = {}
263
300
 
264
301
  # Set Headers
265
302
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
266
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
267
-
268
- unless custom_headers.nil?
269
- custom_headers.each do |key, value|
270
- request_headers[key] = value
271
- end
272
- end
273
-
274
- # Serialize Request
275
- request_headers['Content-Type'] = 'application/json'
276
- unless parameters.nil?
277
- parameters = Deployment.serialize_object(parameters)
278
- end
279
- request_content = JSON.generate(parameters, quirks_mode: true)
280
-
281
- # Send Request
282
- promise = Concurrent::Promise.new do
283
- connection.put do |request|
284
- request.headers = request_headers
285
- request.body = request_content
286
- @client.credentials.sign_request(request) unless @client.credentials.nil?
287
- end
303
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
304
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
305
+ options = {
306
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
307
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
308
+ query_params: {'api-version' => @client.api_version},
309
+ headers: request_headers.merge(custom_headers || {})
310
+ }
311
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
312
+ promise = request.run_promise do |req|
313
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
288
314
  end
289
315
 
290
316
  promise = promise.then do |http_response|
291
317
  status_code = http_response.status
292
318
  response_content = http_response.body
293
- unless (status_code == 200 || status_code == 201)
319
+ unless status_code == 200
294
320
  error_model = JSON.load(response_content)
295
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
321
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
296
322
  end
297
323
 
298
324
  # Create Result
299
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
325
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
300
326
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
301
327
  # Deserialize Response
302
328
  if status_code == 200
303
329
  begin
304
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
330
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
331
  unless parsed_response.nil?
306
332
  parsed_response = DeploymentExtended.deserialize_object(parsed_response)
307
333
  end
308
334
  result.body = parsed_response
309
335
  rescue Exception => e
310
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
311
- end
312
- end
313
- # Deserialize Response
314
- if status_code == 201
315
- begin
316
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
317
- unless parsed_response.nil?
318
- parsed_response = DeploymentExtended.deserialize_object(parsed_response)
319
- end
320
- result.body = parsed_response
321
- rescue Exception => e
322
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
336
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
323
337
  end
324
338
  end
325
339
 
@@ -330,9 +344,10 @@ module Azure::ARM::Resources
330
344
  end
331
345
 
332
346
  #
333
- # Get a deployment.
334
- # @param resource_group_name [String] The name of the resource group to get.
335
- # The name is case insensitive.
347
+ # Cancel a currently running template deployment.
348
+ #
349
+ # @param resource_group_name [String] The name of the resource group. The name
350
+ # is case insensitive.
336
351
  # @param deployment_name [String] The name of the deployment.
337
352
  # @param [Hash{String => String}] The hash of custom headers need to be
338
353
  # applied to HTTP request.
@@ -340,77 +355,124 @@ module Azure::ARM::Resources
340
355
  # @return [Concurrent::Promise] Promise object which allows to get HTTP
341
356
  # response.
342
357
  #
343
- def get(resource_group_name, deployment_name, custom_headers = nil)
358
+ def cancel(resource_group_name, deployment_name, custom_headers = nil)
344
359
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
345
360
  fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
346
361
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
347
362
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
348
- # Construct URL
349
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}"
350
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
351
- path['{deploymentName}'] = ERB::Util.url_encode(deployment_name) if path.include?('{deploymentName}')
352
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
353
- url = URI.join(@client.base_url, path)
354
- properties = {}
355
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
356
- unless url.query.nil?
357
- url.query.split('&').each do |url_item|
358
- url_items_parts = url_item.split('=')
359
- properties[url_items_parts[0]] = url_items_parts[1]
360
- end
361
- end
362
- properties.reject!{ |key, value| value.nil? }
363
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
364
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
365
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
366
- url = URI.parse(corrected_url)
367
-
368
- connection = Faraday.new(:url => url) do |faraday|
369
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
370
- faraday.use :cookie_jar
371
- faraday.adapter Faraday.default_adapter
372
- end
373
- request_headers = Hash.new
363
+ request_headers = {}
374
364
 
375
365
  # Set Headers
376
366
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
377
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
367
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
368
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'
369
+ options = {
370
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
371
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
372
+ query_params: {'api-version' => @client.api_version},
373
+ headers: request_headers.merge(custom_headers || {})
374
+ }
375
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
376
+ promise = request.run_promise do |req|
377
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
378
+ end
378
379
 
379
- unless custom_headers.nil?
380
- custom_headers.each do |key, value|
381
- request_headers[key] = value
380
+ promise = promise.then do |http_response|
381
+ status_code = http_response.status
382
+ response_content = http_response.body
383
+ unless status_code == 204
384
+ error_model = JSON.load(response_content)
385
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
382
386
  end
387
+
388
+ # Create Result
389
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
390
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
391
+
392
+ result
383
393
  end
384
394
 
385
- # Send Request
386
- promise = Concurrent::Promise.new do
387
- connection.get do |request|
388
- request.headers = request_headers
389
- @client.credentials.sign_request(request) unless @client.credentials.nil?
390
- end
395
+ promise.execute
396
+ end
397
+
398
+ #
399
+ # Validate a deployment template.
400
+ #
401
+ # @param resource_group_name [String] The name of the resource group. The name
402
+ # is case insensitive.
403
+ # @param deployment_name [String] The name of the deployment.
404
+ # @param parameters [Deployment] Deployment to validate.
405
+ # @param [Hash{String => String}] The hash of custom headers need to be
406
+ # applied to HTTP request.
407
+ #
408
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
409
+ # response.
410
+ #
411
+ def validate(resource_group_name, deployment_name, parameters, custom_headers = nil)
412
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
413
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
414
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
415
+ parameters.validate unless parameters.nil?
416
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
417
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
418
+ request_headers = {}
419
+
420
+ # Set Headers
421
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
422
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
423
+
424
+ # Serialize Request
425
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
426
+ unless parameters.nil?
427
+ parameters = Deployment.serialize_object(parameters)
428
+ end
429
+ request_content = JSON.generate(parameters, quirks_mode: true)
430
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'
431
+ options = {
432
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
433
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
434
+ query_params: {'api-version' => @client.api_version},
435
+ body: request_content,
436
+ headers: request_headers.merge(custom_headers || {})
437
+ }
438
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
439
+ promise = request.run_promise do |req|
440
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
391
441
  end
392
442
 
393
443
  promise = promise.then do |http_response|
394
444
  status_code = http_response.status
395
445
  response_content = http_response.body
396
- unless (status_code == 200)
446
+ unless status_code == 200 || status_code == 400
397
447
  error_model = JSON.load(response_content)
398
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
448
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
399
449
  end
400
450
 
401
451
  # Create Result
402
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
452
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
403
453
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
404
454
  # Deserialize Response
405
455
  if status_code == 200
406
456
  begin
407
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
457
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
408
458
  unless parsed_response.nil?
409
- parsed_response = DeploymentExtended.deserialize_object(parsed_response)
459
+ parsed_response = DeploymentValidateResult.deserialize_object(parsed_response)
410
460
  end
411
461
  result.body = parsed_response
412
462
  rescue Exception => e
413
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
463
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
464
+ end
465
+ end
466
+ # Deserialize Response
467
+ if status_code == 400
468
+ begin
469
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
470
+ unless parsed_response.nil?
471
+ parsed_response = DeploymentValidateResult.deserialize_object(parsed_response)
472
+ end
473
+ result.body = parsed_response
474
+ rescue Exception => e
475
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
414
476
  end
415
477
  end
416
478
 
@@ -422,6 +484,7 @@ module Azure::ARM::Resources
422
484
 
423
485
  #
424
486
  # Get a list of deployments.
487
+ #
425
488
  # @param resource_group_name [String] The name of the resource group to filter
426
489
  # by. The name is case insensitive.
427
490
  # @param filter [String] The filter to apply on the operation.
@@ -437,73 +500,44 @@ module Azure::ARM::Resources
437
500
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
438
501
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
439
502
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
440
- # Construct URL
441
- path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/"
442
- path['{resourceGroupName}'] = ERB::Util.url_encode(resource_group_name) if path.include?('{resourceGroupName}')
443
- path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
444
- url = URI.join(@client.base_url, path)
445
- properties = {}
446
- properties['$filter'] = ERB::Util.url_encode(filter.to_s) unless filter.nil?
447
- properties['$top'] = ERB::Util.url_encode(top.to_s) unless top.nil?
448
- properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
449
- unless url.query.nil?
450
- url.query.split('&').each do |url_item|
451
- url_items_parts = url_item.split('=')
452
- properties[url_items_parts[0]] = url_items_parts[1]
453
- end
454
- end
455
- properties.reject!{ |key, value| value.nil? }
456
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
457
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
458
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
459
- url = URI.parse(corrected_url)
460
-
461
- connection = Faraday.new(:url => url) do |faraday|
462
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
463
- faraday.use :cookie_jar
464
- faraday.adapter Faraday.default_adapter
465
- end
466
- request_headers = Hash.new
503
+ request_headers = {}
467
504
 
468
505
  # Set Headers
469
506
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
470
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
471
-
472
- unless custom_headers.nil?
473
- custom_headers.each do |key, value|
474
- request_headers[key] = value
475
- end
476
- end
477
-
478
- # Send Request
479
- promise = Concurrent::Promise.new do
480
- connection.get do |request|
481
- request.headers = request_headers
482
- @client.credentials.sign_request(request) unless @client.credentials.nil?
483
- end
507
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
508
+ path_template = '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'
509
+ options = {
510
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
511
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
512
+ query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
513
+ headers: request_headers.merge(custom_headers || {})
514
+ }
515
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
516
+ promise = request.run_promise do |req|
517
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
484
518
  end
485
519
 
486
520
  promise = promise.then do |http_response|
487
521
  status_code = http_response.status
488
522
  response_content = http_response.body
489
- unless (status_code == 200)
523
+ unless status_code == 200
490
524
  error_model = JSON.load(response_content)
491
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
525
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
492
526
  end
493
527
 
494
528
  # Create Result
495
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
529
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
496
530
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
497
531
  # Deserialize Response
498
532
  if status_code == 200
499
533
  begin
500
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
534
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
501
535
  unless parsed_response.nil?
502
536
  parsed_response = DeploymentListResult.deserialize_object(parsed_response)
503
537
  end
504
538
  result.body = parsed_response
505
539
  rescue Exception => e
506
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
540
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
507
541
  end
508
542
  end
509
543
 
@@ -515,6 +549,7 @@ module Azure::ARM::Resources
515
549
 
516
550
  #
517
551
  # Get a list of deployments.
552
+ #
518
553
  # @param next_page_link [String] The NextLink from the previous successful
519
554
  # call to List operation.
520
555
  # @param [Hash{String => String}] The hash of custom headers need to be
@@ -525,69 +560,43 @@ module Azure::ARM::Resources
525
560
  #
526
561
  def list_next(next_page_link, custom_headers = nil)
527
562
  fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
528
- # Construct URL
529
- path = "{nextLink}"
530
- path['{nextLink}'] = next_page_link if path.include?('{nextLink}')
531
- url = URI.parse(path)
532
- properties = {}
533
- unless url.query.nil?
534
- url.query.split('&').each do |url_item|
535
- url_items_parts = url_item.split('=')
536
- properties[url_items_parts[0]] = url_items_parts[1]
537
- end
538
- end
539
- properties.reject!{ |key, value| value.nil? }
540
- url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
541
- fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
542
- corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
543
- url = URI.parse(corrected_url)
544
-
545
- connection = Faraday.new(:url => url) do |faraday|
546
- faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
547
- faraday.use :cookie_jar
548
- faraday.adapter Faraday.default_adapter
549
- end
550
- request_headers = Hash.new
563
+ request_headers = {}
551
564
 
552
565
  # Set Headers
553
566
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
554
- request_headers["accept-language"] = @client.accept_language unless @client.accept_language.nil?
555
-
556
- unless custom_headers.nil?
557
- custom_headers.each do |key, value|
558
- request_headers[key] = value
559
- end
560
- end
561
-
562
- # Send Request
563
- promise = Concurrent::Promise.new do
564
- connection.get do |request|
565
- request.headers = request_headers
566
- @client.credentials.sign_request(request) unless @client.credentials.nil?
567
- end
567
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
568
+ path_template = '{nextLink}'
569
+ options = {
570
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
571
+ skip_encoding_path_params: {'nextLink' => next_page_link},
572
+ headers: request_headers.merge(custom_headers || {})
573
+ }
574
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
575
+ promise = request.run_promise do |req|
576
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
568
577
  end
569
578
 
570
579
  promise = promise.then do |http_response|
571
580
  status_code = http_response.status
572
581
  response_content = http_response.body
573
- unless (status_code == 200)
582
+ unless status_code == 200
574
583
  error_model = JSON.load(response_content)
575
- fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
584
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
576
585
  end
577
586
 
578
587
  # Create Result
579
- result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
588
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
580
589
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
581
590
  # Deserialize Response
582
591
  if status_code == 200
583
592
  begin
584
- parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
593
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
585
594
  unless parsed_response.nil?
586
595
  parsed_response = DeploymentListResult.deserialize_object(parsed_response)
587
596
  end
588
597
  result.body = parsed_response
589
598
  rescue Exception => e
590
- fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
599
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
591
600
  end
592
601
  end
593
602