azure_mgmt_resources 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +3 -0
- data/.travis.yml +3 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +5 -0
- data/azure_mgmt_resources.gemspec +38 -0
- data/lib/azure_mgmt_resources.rb +74 -0
- data/lib/azure_mgmt_resources/Models/basic_dependency.rb +76 -0
- data/lib/azure_mgmt_resources/Models/dependency.rb +105 -0
- data/lib/azure_mgmt_resources/Models/deployment.rb +64 -0
- data/lib/azure_mgmt_resources/Models/deployment_extended.rb +83 -0
- data/lib/azure_mgmt_resources/Models/deployment_extended_filter.rb +58 -0
- data/lib/azure_mgmt_resources/Models/deployment_list_result.rb +88 -0
- data/lib/azure_mgmt_resources/Models/deployment_mode.rb +15 -0
- data/lib/azure_mgmt_resources/Models/deployment_operation.rb +83 -0
- data/lib/azure_mgmt_resources/Models/deployment_operation_properties.rb +102 -0
- data/lib/azure_mgmt_resources/Models/deployment_operations_list_result.rb +88 -0
- data/lib/azure_mgmt_resources/Models/deployment_properties.rb +116 -0
- data/lib/azure_mgmt_resources/Models/deployment_properties_extended.rb +216 -0
- data/lib/azure_mgmt_resources/Models/deployment_validate_result.rb +82 -0
- data/lib/azure_mgmt_resources/Models/generic_resource.rb +103 -0
- data/lib/azure_mgmt_resources/Models/generic_resource_filter.rb +76 -0
- data/lib/azure_mgmt_resources/Models/parameters_link.rb +68 -0
- data/lib/azure_mgmt_resources/Models/plan.rb +85 -0
- data/lib/azure_mgmt_resources/Models/provider.rb +106 -0
- data/lib/azure_mgmt_resources/Models/provider_list_result.rb +87 -0
- data/lib/azure_mgmt_resources/Models/provider_resource_type.rb +88 -0
- data/lib/azure_mgmt_resources/Models/resource_group.rb +105 -0
- data/lib/azure_mgmt_resources/Models/resource_group_extended.rb +113 -0
- data/lib/azure_mgmt_resources/Models/resource_group_extended_filter.rb +63 -0
- data/lib/azure_mgmt_resources/Models/resource_group_filter.rb +67 -0
- data/lib/azure_mgmt_resources/Models/resource_group_format_resource_properties.rb +54 -0
- data/lib/azure_mgmt_resources/Models/resource_group_list_result.rb +88 -0
- data/lib/azure_mgmt_resources/Models/resource_group_properties.rb +58 -0
- data/lib/azure_mgmt_resources/Models/resource_list_result.rb +88 -0
- data/lib/azure_mgmt_resources/Models/resource_management_error.rb +77 -0
- data/lib/azure_mgmt_resources/Models/resource_management_error_with_details.rb +106 -0
- data/lib/azure_mgmt_resources/Models/resource_provider_operation_definition.rb +74 -0
- data/lib/azure_mgmt_resources/Models/resource_provider_operation_detail_list_result.rb +80 -0
- data/lib/azure_mgmt_resources/Models/resource_provider_operation_display_properties.rb +95 -0
- data/lib/azure_mgmt_resources/Models/resources_move_info.rb +67 -0
- data/lib/azure_mgmt_resources/Models/tag_count.rb +67 -0
- data/lib/azure_mgmt_resources/Models/tag_details.rb +112 -0
- data/lib/azure_mgmt_resources/Models/tag_value.rb +82 -0
- data/lib/azure_mgmt_resources/Models/tags_list_result.rb +87 -0
- data/lib/azure_mgmt_resources/Models/target_resource.rb +76 -0
- data/lib/azure_mgmt_resources/Models/template_link.rb +68 -0
- data/lib/azure_mgmt_resources/deployment_operations.rb +297 -0
- data/lib/azure_mgmt_resources/deployments.rb +601 -0
- data/lib/azure_mgmt_resources/module_definition.rb +6 -0
- data/lib/azure_mgmt_resources/providers.rb +461 -0
- data/lib/azure_mgmt_resources/resource_groups.rb +891 -0
- data/lib/azure_mgmt_resources/resource_management_client.rb +85 -0
- data/lib/azure_mgmt_resources/resource_provider_operation_details.rb +126 -0
- data/lib/azure_mgmt_resources/resources.rb +737 -0
- data/lib/azure_mgmt_resources/tags.rb +546 -0
- data/lib/azure_mgmt_resources/version.rb +6 -0
- metadata +235 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Resources
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# List of subscription tags.
|
10
|
+
#
|
11
|
+
class TagsListResult
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [Array<TagDetails>] Gets or sets the list of tags.
|
16
|
+
attr_accessor :value
|
17
|
+
|
18
|
+
# @return [String] Gets or sets the URL to get the next set of results.
|
19
|
+
attr_accessor :next_link
|
20
|
+
|
21
|
+
#
|
22
|
+
# Validate the object. Throws ValidationError if validation fails.
|
23
|
+
#
|
24
|
+
def validate
|
25
|
+
@value.each{ |e| e.validate if e.respond_to?(:validate) } unless @value.nil?
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Serializes given Model object into Ruby Hash.
|
30
|
+
# @param object Model object to serialize.
|
31
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
32
|
+
#
|
33
|
+
def self.serialize_object(object)
|
34
|
+
object.validate
|
35
|
+
output_object = {}
|
36
|
+
|
37
|
+
serialized_property = object.value
|
38
|
+
unless serialized_property.nil?
|
39
|
+
serializedArray = []
|
40
|
+
serialized_property.each do |element|
|
41
|
+
unless element.nil?
|
42
|
+
element = TagDetails.serialize_object(element)
|
43
|
+
end
|
44
|
+
serializedArray.push(element)
|
45
|
+
end
|
46
|
+
serialized_property = serializedArray
|
47
|
+
end
|
48
|
+
output_object['value'] = serialized_property unless serialized_property.nil?
|
49
|
+
|
50
|
+
serialized_property = object.next_link
|
51
|
+
output_object['nextLink'] = serialized_property unless serialized_property.nil?
|
52
|
+
|
53
|
+
output_object
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Deserializes given Ruby Hash into Model object.
|
58
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
59
|
+
# @return [TagsListResult] Deserialized object.
|
60
|
+
#
|
61
|
+
def self.deserialize_object(object)
|
62
|
+
return if object.nil?
|
63
|
+
output_object = TagsListResult.new
|
64
|
+
|
65
|
+
deserialized_property = object['value']
|
66
|
+
unless deserialized_property.nil?
|
67
|
+
deserializedArray = [];
|
68
|
+
deserialized_property.each do |element1|
|
69
|
+
unless element1.nil?
|
70
|
+
element1 = TagDetails.deserialize_object(element1)
|
71
|
+
end
|
72
|
+
deserializedArray.push(element1);
|
73
|
+
end
|
74
|
+
deserialized_property = deserializedArray;
|
75
|
+
end
|
76
|
+
output_object.value = deserialized_property
|
77
|
+
|
78
|
+
deserialized_property = object['nextLink']
|
79
|
+
output_object.next_link = deserialized_property
|
80
|
+
|
81
|
+
output_object.validate
|
82
|
+
|
83
|
+
output_object
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Resources
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Target resource.
|
10
|
+
#
|
11
|
+
class TargetResource
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] Gets or sets the ID of the resource.
|
16
|
+
attr_accessor :id
|
17
|
+
|
18
|
+
# @return [String] Gets or sets the name of the resource.
|
19
|
+
attr_accessor :resource_name
|
20
|
+
|
21
|
+
# @return [String] Gets or sets the type of the resource.
|
22
|
+
attr_accessor :resource_type
|
23
|
+
|
24
|
+
#
|
25
|
+
# Validate the object. Throws ValidationError if validation fails.
|
26
|
+
#
|
27
|
+
def validate
|
28
|
+
# Nothing to validate
|
29
|
+
end
|
30
|
+
|
31
|
+
#
|
32
|
+
# Serializes given Model object into Ruby Hash.
|
33
|
+
# @param object Model object to serialize.
|
34
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
35
|
+
#
|
36
|
+
def self.serialize_object(object)
|
37
|
+
object.validate
|
38
|
+
output_object = {}
|
39
|
+
|
40
|
+
serialized_property = object.id
|
41
|
+
output_object['id'] = serialized_property unless serialized_property.nil?
|
42
|
+
|
43
|
+
serialized_property = object.resource_name
|
44
|
+
output_object['resourceName'] = serialized_property unless serialized_property.nil?
|
45
|
+
|
46
|
+
serialized_property = object.resource_type
|
47
|
+
output_object['resourceType'] = serialized_property unless serialized_property.nil?
|
48
|
+
|
49
|
+
output_object
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# Deserializes given Ruby Hash into Model object.
|
54
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
55
|
+
# @return [TargetResource] Deserialized object.
|
56
|
+
#
|
57
|
+
def self.deserialize_object(object)
|
58
|
+
return if object.nil?
|
59
|
+
output_object = TargetResource.new
|
60
|
+
|
61
|
+
deserialized_property = object['id']
|
62
|
+
output_object.id = deserialized_property
|
63
|
+
|
64
|
+
deserialized_property = object['resourceName']
|
65
|
+
output_object.resource_name = deserialized_property
|
66
|
+
|
67
|
+
deserialized_property = object['resourceType']
|
68
|
+
output_object.resource_type = deserialized_property
|
69
|
+
|
70
|
+
output_object.validate
|
71
|
+
|
72
|
+
output_object
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Resources
|
7
|
+
module Models
|
8
|
+
#
|
9
|
+
# Entity representing the reference to the template.
|
10
|
+
#
|
11
|
+
class TemplateLink
|
12
|
+
|
13
|
+
include MsRestAzure
|
14
|
+
|
15
|
+
# @return [String] URI referencing the template.
|
16
|
+
attr_accessor :uri
|
17
|
+
|
18
|
+
# @return [String] If included it must match the ContentVersion in the
|
19
|
+
# template.
|
20
|
+
attr_accessor :content_version
|
21
|
+
|
22
|
+
#
|
23
|
+
# Validate the object. Throws ValidationError if validation fails.
|
24
|
+
#
|
25
|
+
def validate
|
26
|
+
# Nothing to validate
|
27
|
+
end
|
28
|
+
|
29
|
+
#
|
30
|
+
# Serializes given Model object into Ruby Hash.
|
31
|
+
# @param object Model object to serialize.
|
32
|
+
# @return [Hash] Serialized object in form of Ruby Hash.
|
33
|
+
#
|
34
|
+
def self.serialize_object(object)
|
35
|
+
object.validate
|
36
|
+
output_object = {}
|
37
|
+
|
38
|
+
serialized_property = object.uri
|
39
|
+
output_object['uri'] = serialized_property unless serialized_property.nil?
|
40
|
+
|
41
|
+
serialized_property = object.content_version
|
42
|
+
output_object['contentVersion'] = serialized_property unless serialized_property.nil?
|
43
|
+
|
44
|
+
output_object
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# Deserializes given Ruby Hash into Model object.
|
49
|
+
# @param object [Hash] Ruby Hash object to deserialize.
|
50
|
+
# @return [TemplateLink] Deserialized object.
|
51
|
+
#
|
52
|
+
def self.deserialize_object(object)
|
53
|
+
return if object.nil?
|
54
|
+
output_object = TemplateLink.new
|
55
|
+
|
56
|
+
deserialized_property = object['uri']
|
57
|
+
output_object.uri = deserialized_property
|
58
|
+
|
59
|
+
deserialized_property = object['contentVersion']
|
60
|
+
output_object.content_version = deserialized_property
|
61
|
+
|
62
|
+
output_object.validate
|
63
|
+
|
64
|
+
output_object
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,297 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.11.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Resources
|
7
|
+
#
|
8
|
+
# DeploymentOperations
|
9
|
+
#
|
10
|
+
class DeploymentOperations
|
11
|
+
include Azure::ARM::Resources::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the DeploymentOperations class.
|
16
|
+
# @param client service class for accessing basic functionality.
|
17
|
+
#
|
18
|
+
def initialize(client)
|
19
|
+
@client = client
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return reference to the ResourceManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# Get a list of deployments operations.
|
27
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
28
|
+
# is case insensitive.
|
29
|
+
# @param deployment_name [String] The name of the deployment.
|
30
|
+
# @param operation_id [String] Operation Id.
|
31
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
32
|
+
# applied to HTTP request.
|
33
|
+
#
|
34
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
35
|
+
# response.
|
36
|
+
#
|
37
|
+
def get(resource_group_name, deployment_name, operation_id, custom_headers = nil)
|
38
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
39
|
+
fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
|
40
|
+
fail ArgumentError, 'operation_id is nil' if operation_id.nil?
|
41
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
42
|
+
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
|
70
|
+
|
71
|
+
# Set Headers
|
72
|
+
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
|
87
|
+
end
|
88
|
+
|
89
|
+
promise = promise.then do |http_response|
|
90
|
+
status_code = http_response.status
|
91
|
+
response_content = http_response.body
|
92
|
+
unless (status_code == 200)
|
93
|
+
error_model = JSON.load(response_content)
|
94
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Create Result
|
98
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
99
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
100
|
+
# Deserialize Response
|
101
|
+
if status_code == 200
|
102
|
+
begin
|
103
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
104
|
+
unless parsed_response.nil?
|
105
|
+
parsed_response = DeploymentOperation.deserialize_object(parsed_response)
|
106
|
+
end
|
107
|
+
result.body = parsed_response
|
108
|
+
rescue Exception => e
|
109
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
result
|
114
|
+
end
|
115
|
+
|
116
|
+
promise.execute
|
117
|
+
end
|
118
|
+
|
119
|
+
#
|
120
|
+
# Gets a list of deployments operations.
|
121
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
122
|
+
# is case insensitive.
|
123
|
+
# @param deployment_name [String] The name of the deployment.
|
124
|
+
# @param top [Integer] Query parameters.
|
125
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
126
|
+
# applied to HTTP request.
|
127
|
+
#
|
128
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
129
|
+
# response.
|
130
|
+
#
|
131
|
+
def list(resource_group_name, deployment_name, top = nil, custom_headers = nil)
|
132
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
133
|
+
fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
|
134
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
135
|
+
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
|
163
|
+
|
164
|
+
# Set Headers
|
165
|
+
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
|
180
|
+
end
|
181
|
+
|
182
|
+
promise = promise.then do |http_response|
|
183
|
+
status_code = http_response.status
|
184
|
+
response_content = http_response.body
|
185
|
+
unless (status_code == 200)
|
186
|
+
error_model = JSON.load(response_content)
|
187
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
188
|
+
end
|
189
|
+
|
190
|
+
# Create Result
|
191
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
192
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
193
|
+
# Deserialize Response
|
194
|
+
if status_code == 200
|
195
|
+
begin
|
196
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
197
|
+
unless parsed_response.nil?
|
198
|
+
parsed_response = DeploymentOperationsListResult.deserialize_object(parsed_response)
|
199
|
+
end
|
200
|
+
result.body = parsed_response
|
201
|
+
rescue Exception => e
|
202
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
result
|
207
|
+
end
|
208
|
+
|
209
|
+
promise.execute
|
210
|
+
end
|
211
|
+
|
212
|
+
#
|
213
|
+
# Gets a list of deployments operations.
|
214
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
215
|
+
# call to List operation.
|
216
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
217
|
+
# applied to HTTP request.
|
218
|
+
#
|
219
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
220
|
+
# response.
|
221
|
+
#
|
222
|
+
def list_next(next_page_link, custom_headers = nil)
|
223
|
+
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
|
247
|
+
|
248
|
+
# Set Headers
|
249
|
+
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
|
264
|
+
end
|
265
|
+
|
266
|
+
promise = promise.then do |http_response|
|
267
|
+
status_code = http_response.status
|
268
|
+
response_content = http_response.body
|
269
|
+
unless (status_code == 200)
|
270
|
+
error_model = JSON.load(response_content)
|
271
|
+
fail MsRestAzure::AzureOperationError.new(connection, http_response, error_model)
|
272
|
+
end
|
273
|
+
|
274
|
+
# Create Result
|
275
|
+
result = MsRestAzure::AzureOperationResponse.new(connection, http_response)
|
276
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
277
|
+
# Deserialize Response
|
278
|
+
if status_code == 200
|
279
|
+
begin
|
280
|
+
parsed_response = JSON.load(response_content) unless response_content.to_s.empty?
|
281
|
+
unless parsed_response.nil?
|
282
|
+
parsed_response = DeploymentOperationsListResult.deserialize_object(parsed_response)
|
283
|
+
end
|
284
|
+
result.body = parsed_response
|
285
|
+
rescue Exception => e
|
286
|
+
fail MsRest::DeserializationError.new("Error occured in deserializing the response", e.message, e.backtrace, response_content)
|
287
|
+
end
|
288
|
+
end
|
289
|
+
|
290
|
+
result
|
291
|
+
end
|
292
|
+
|
293
|
+
promise.execute
|
294
|
+
end
|
295
|
+
|
296
|
+
end
|
297
|
+
end
|