azure_mgmt_compute 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/azure_mgmt_compute.gemspec +3 -11
- data/lib/azure_mgmt_compute/availability_sets.rb +226 -241
- data/lib/azure_mgmt_compute/compute_management_client.rb +26 -11
- data/lib/azure_mgmt_compute/models/additional_unattend_content.rb +8 -11
- data/lib/azure_mgmt_compute/models/api_entity_reference.rb +58 -0
- data/lib/azure_mgmt_compute/models/api_error.rb +4 -6
- data/lib/azure_mgmt_compute/models/api_error_base.rb +1 -3
- data/lib/azure_mgmt_compute/models/availability_set.rb +1 -3
- data/lib/azure_mgmt_compute/models/availability_set_list_result.rb +4 -6
- data/lib/azure_mgmt_compute/models/availability_set_properties.rb +9 -11
- data/lib/azure_mgmt_compute/models/boot_diagnostics.rb +67 -0
- data/lib/azure_mgmt_compute/models/boot_diagnostics_instance_view.rb +65 -0
- data/lib/azure_mgmt_compute/models/caching_types.rb +1 -1
- data/lib/azure_mgmt_compute/models/component_names.rb +1 -1
- data/lib/azure_mgmt_compute/models/compute_long_running_operation_properties.rb +1 -3
- data/lib/azure_mgmt_compute/models/compute_long_running_operation_result.rb +3 -6
- data/lib/azure_mgmt_compute/models/compute_operation_status.rb +1 -1
- data/lib/azure_mgmt_compute/models/data_disk.rb +27 -26
- data/lib/azure_mgmt_compute/models/data_disk_image.rb +1 -3
- data/lib/azure_mgmt_compute/models/delete_operation_result.rb +6 -5
- data/lib/azure_mgmt_compute/models/diagnostics_profile.rb +62 -0
- data/lib/azure_mgmt_compute/models/disk_create_option_types.rb +1 -1
- data/lib/azure_mgmt_compute/models/disk_encryption_settings.rb +81 -0
- data/lib/azure_mgmt_compute/models/disk_instance_view.rb +4 -6
- data/lib/azure_mgmt_compute/models/hardware_profile.rb +15 -9
- data/lib/azure_mgmt_compute/models/image_reference.rb +1 -3
- data/lib/azure_mgmt_compute/models/inner_error.rb +1 -3
- data/lib/azure_mgmt_compute/models/instance_view_status.rb +3 -5
- data/lib/azure_mgmt_compute/models/key_vault_key_reference.rb +74 -0
- data/lib/azure_mgmt_compute/models/key_vault_secret_reference.rb +75 -0
- data/lib/azure_mgmt_compute/models/linux_configuration.rb +1 -3
- data/lib/azure_mgmt_compute/models/list_usages_result.rb +4 -6
- data/lib/azure_mgmt_compute/models/network_interface_reference.rb +1 -3
- data/lib/azure_mgmt_compute/models/network_interface_reference_properties.rb +1 -3
- data/lib/azure_mgmt_compute/models/network_profile.rb +4 -6
- data/lib/azure_mgmt_compute/models/operating_system_types.rb +1 -1
- data/lib/azure_mgmt_compute/models/operation_status.rb +1 -1
- data/lib/azure_mgmt_compute/models/osdisk.rb +54 -26
- data/lib/azure_mgmt_compute/models/osdisk_image.rb +4 -6
- data/lib/azure_mgmt_compute/models/osprofile.rb +4 -6
- data/lib/azure_mgmt_compute/models/pass_names.rb +1 -1
- data/lib/azure_mgmt_compute/models/plan.rb +1 -3
- data/lib/azure_mgmt_compute/models/protocol_types.rb +1 -1
- data/lib/azure_mgmt_compute/models/purchase_plan.rb +4 -4
- data/lib/azure_mgmt_compute/models/setting_names.rb +1 -1
- data/lib/azure_mgmt_compute/models/sku.rb +75 -0
- data/lib/azure_mgmt_compute/models/ssh_configuration.rb +4 -6
- data/lib/azure_mgmt_compute/models/ssh_public_key.rb +1 -3
- data/lib/azure_mgmt_compute/models/status_level_types.rb +1 -1
- data/lib/azure_mgmt_compute/models/storage_profile.rb +4 -6
- data/lib/azure_mgmt_compute/models/{usage_unit.rb → upgrade_mode.rb} +5 -4
- data/lib/azure_mgmt_compute/models/upgrade_policy.rb +60 -0
- data/lib/azure_mgmt_compute/models/usage.rb +7 -9
- data/lib/azure_mgmt_compute/models/usage_name.rb +1 -3
- data/lib/azure_mgmt_compute/models/vault_certificate.rb +1 -3
- data/lib/azure_mgmt_compute/models/vault_secret_group.rb +6 -8
- data/lib/azure_mgmt_compute/models/virtual_hard_disk.rb +1 -3
- data/lib/azure_mgmt_compute/models/virtual_machine.rb +4 -6
- data/lib/azure_mgmt_compute/models/virtual_machine_agent_instance_view.rb +7 -9
- data/lib/azure_mgmt_compute/models/virtual_machine_capture_parameters.rb +4 -4
- data/lib/azure_mgmt_compute/models/virtual_machine_capture_result.rb +68 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_capture_result_properties.rb +56 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_extension.rb +1 -3
- data/lib/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +1 -3
- data/lib/azure_mgmt_compute/models/virtual_machine_extension_image.rb +15 -15
- data/lib/azure_mgmt_compute/models/virtual_machine_extension_image_properties.rb +4 -4
- data/lib/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +7 -9
- data/lib/azure_mgmt_compute/models/virtual_machine_extension_properties.rb +11 -3
- data/lib/azure_mgmt_compute/models/virtual_machine_image.rb +15 -15
- data/lib/azure_mgmt_compute/models/virtual_machine_image_properties.rb +4 -6
- data/lib/azure_mgmt_compute/models/virtual_machine_image_resource.rb +9 -9
- data/lib/azure_mgmt_compute/models/virtual_machine_instance_view.rb +28 -14
- data/lib/azure_mgmt_compute/models/virtual_machine_list_result.rb +4 -6
- data/lib/azure_mgmt_compute/models/virtual_machine_properties.rb +29 -5
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set.rb +108 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_properties.rb +116 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +125 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +79 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +78 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration_properties.rb +127 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +88 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +80 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration_properties.rb +89 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +129 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +147 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_properties.rb +89 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +88 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +90 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_scale_type.rb +16 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +78 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +165 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +87 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +57 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +59 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +202 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +77 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +114 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmproperties.rb +190 -0
- data/lib/azure_mgmt_compute/models/virtual_machine_size.rb +1 -3
- data/lib/azure_mgmt_compute/models/virtual_machine_size_list_result.rb +4 -6
- data/lib/azure_mgmt_compute/models/virtual_machine_size_types.rb +53 -45
- data/lib/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +68 -0
- data/lib/azure_mgmt_compute/models/win_rmconfiguration.rb +4 -6
- data/lib/azure_mgmt_compute/models/win_rmlistener.rb +3 -5
- data/lib/azure_mgmt_compute/models/windows_configuration.rb +4 -6
- data/lib/azure_mgmt_compute/module_definition.rb +5 -3
- data/lib/azure_mgmt_compute/usage_operations.rb +75 -42
- data/lib/azure_mgmt_compute/version.rb +5 -3
- data/lib/azure_mgmt_compute/virtual_machine_extension_images.rb +71 -158
- data/lib/azure_mgmt_compute/virtual_machine_extensions.rb +66 -149
- data/lib/azure_mgmt_compute/virtual_machine_images.rb +121 -264
- data/lib/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +750 -0
- data/lib/azure_mgmt_compute/virtual_machine_scale_sets.rb +1327 -0
- data/lib/azure_mgmt_compute/virtual_machine_sizes.rb +75 -42
- data/lib/azure_mgmt_compute/virtual_machines.rb +397 -623
- data/lib/azure_mgmt_compute.rb +57 -18
- metadata +50 -128
- data/.gitignore +0 -10
- data/.travis.yml +0 -3
- data/Gemfile +0 -17
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
# Code generated by Microsoft (R) AutoRest Code Generator 0.
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
3
|
# Changes may cause incorrect behavior and will be lost if the code is
|
4
4
|
# regenerated.
|
5
5
|
|
6
6
|
module Azure::ARM::Compute
|
7
7
|
#
|
8
|
-
#
|
8
|
+
# The Compute Management Client.
|
9
9
|
#
|
10
10
|
class VirtualMachineImages
|
11
11
|
include Azure::ARM::Compute::Models
|
@@ -24,6 +24,7 @@ module Azure::ARM::Compute
|
|
24
24
|
|
25
25
|
#
|
26
26
|
# Gets a virtual machine image.
|
27
|
+
#
|
27
28
|
# @param location [String]
|
28
29
|
# @param publisher_name [String]
|
29
30
|
# @param offer [String]
|
@@ -43,75 +44,44 @@ module Azure::ARM::Compute
|
|
43
44
|
fail ArgumentError, 'version is nil' if version.nil?
|
44
45
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
45
46
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
46
|
-
|
47
|
-
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}"
|
48
|
-
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
49
|
-
path['{publisherName}'] = ERB::Util.url_encode(publisher_name) if path.include?('{publisherName}')
|
50
|
-
path['{offer}'] = ERB::Util.url_encode(offer) if path.include?('{offer}')
|
51
|
-
path['{skus}'] = ERB::Util.url_encode(skus) if path.include?('{skus}')
|
52
|
-
path['{version}'] = ERB::Util.url_encode(version) if path.include?('{version}')
|
53
|
-
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
54
|
-
url = URI.join(@client.base_url, path)
|
55
|
-
properties = {}
|
56
|
-
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
57
|
-
unless url.query.nil?
|
58
|
-
url.query.split('&').each do |url_item|
|
59
|
-
url_items_parts = url_item.split('=')
|
60
|
-
properties[url_items_parts[0]] = url_items_parts[1]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
properties.reject!{ |key, value| value.nil? }
|
64
|
-
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
65
|
-
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
66
|
-
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
67
|
-
url = URI.parse(corrected_url)
|
68
|
-
|
69
|
-
connection = Faraday.new(:url => url) do |faraday|
|
70
|
-
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
71
|
-
faraday.use :cookie_jar
|
72
|
-
faraday.adapter Faraday.default_adapter
|
73
|
-
end
|
74
|
-
request_headers = Hash.new
|
47
|
+
request_headers = {}
|
75
48
|
|
76
49
|
# Set Headers
|
77
50
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
78
|
-
request_headers[
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
promise =
|
88
|
-
|
89
|
-
request.headers = request_headers
|
90
|
-
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
91
|
-
end
|
51
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
52
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions/{version}'
|
53
|
+
options = {
|
54
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
55
|
+
path_params: {'location' => location,'publisherName' => publisher_name,'offer' => offer,'skus' => skus,'version' => version,'subscriptionId' => @client.subscription_id},
|
56
|
+
query_params: {'api-version' => @client.api_version},
|
57
|
+
headers: request_headers.merge(custom_headers || {})
|
58
|
+
}
|
59
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
60
|
+
promise = request.run_promise do |req|
|
61
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
92
62
|
end
|
93
63
|
|
94
64
|
promise = promise.then do |http_response|
|
95
65
|
status_code = http_response.status
|
96
66
|
response_content = http_response.body
|
97
|
-
unless
|
67
|
+
unless status_code == 200
|
98
68
|
error_model = JSON.load(response_content)
|
99
|
-
fail MsRestAzure::AzureOperationError.new(
|
69
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
100
70
|
end
|
101
71
|
|
102
72
|
# Create Result
|
103
|
-
result = MsRestAzure::AzureOperationResponse.new(
|
73
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
104
74
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
105
75
|
# Deserialize Response
|
106
76
|
if status_code == 200
|
107
77
|
begin
|
108
|
-
parsed_response = JSON.load(response_content)
|
78
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
109
79
|
unless parsed_response.nil?
|
110
80
|
parsed_response = VirtualMachineImage.deserialize_object(parsed_response)
|
111
81
|
end
|
112
82
|
result.body = parsed_response
|
113
83
|
rescue Exception => e
|
114
|
-
fail MsRest::DeserializationError.new(
|
84
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
115
85
|
end
|
116
86
|
end
|
117
87
|
|
@@ -122,93 +92,73 @@ module Azure::ARM::Compute
|
|
122
92
|
end
|
123
93
|
|
124
94
|
#
|
125
|
-
# Gets a list of virtual machine
|
95
|
+
# Gets a list of virtual machine images.
|
96
|
+
#
|
126
97
|
# @param location [String]
|
127
98
|
# @param publisher_name [String]
|
99
|
+
# @param offer [String]
|
100
|
+
# @param skus [String]
|
101
|
+
# @param filter [String] The filter to apply on the operation.
|
102
|
+
# @param top [Integer]
|
103
|
+
# @param orderby [String]
|
128
104
|
# @param [Hash{String => String}] The hash of custom headers need to be
|
129
105
|
# applied to HTTP request.
|
130
106
|
#
|
131
107
|
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
132
108
|
# response.
|
133
109
|
#
|
134
|
-
def
|
110
|
+
def list(location, publisher_name, offer, skus, filter = nil, top = nil, orderby = nil, custom_headers = nil)
|
135
111
|
fail ArgumentError, 'location is nil' if location.nil?
|
136
112
|
fail ArgumentError, 'publisher_name is nil' if publisher_name.nil?
|
113
|
+
fail ArgumentError, 'offer is nil' if offer.nil?
|
114
|
+
fail ArgumentError, 'skus is nil' if skus.nil?
|
137
115
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
138
116
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
139
|
-
|
140
|
-
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers"
|
141
|
-
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
142
|
-
path['{publisherName}'] = ERB::Util.url_encode(publisher_name) if path.include?('{publisherName}')
|
143
|
-
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
144
|
-
url = URI.join(@client.base_url, path)
|
145
|
-
properties = {}
|
146
|
-
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
147
|
-
unless url.query.nil?
|
148
|
-
url.query.split('&').each do |url_item|
|
149
|
-
url_items_parts = url_item.split('=')
|
150
|
-
properties[url_items_parts[0]] = url_items_parts[1]
|
151
|
-
end
|
152
|
-
end
|
153
|
-
properties.reject!{ |key, value| value.nil? }
|
154
|
-
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
155
|
-
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
156
|
-
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
157
|
-
url = URI.parse(corrected_url)
|
158
|
-
|
159
|
-
connection = Faraday.new(:url => url) do |faraday|
|
160
|
-
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
161
|
-
faraday.use :cookie_jar
|
162
|
-
faraday.adapter Faraday.default_adapter
|
163
|
-
end
|
164
|
-
request_headers = Hash.new
|
117
|
+
request_headers = {}
|
165
118
|
|
166
119
|
# Set Headers
|
167
120
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
168
|
-
request_headers[
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
promise =
|
178
|
-
|
179
|
-
request.headers = request_headers
|
180
|
-
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
181
|
-
end
|
121
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
122
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions'
|
123
|
+
options = {
|
124
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
125
|
+
path_params: {'location' => location,'publisherName' => publisher_name,'offer' => offer,'skus' => skus,'subscriptionId' => @client.subscription_id},
|
126
|
+
query_params: {'$filter' => filter,'$top' => top,'$orderby' => orderby,'api-version' => @client.api_version},
|
127
|
+
headers: request_headers.merge(custom_headers || {})
|
128
|
+
}
|
129
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
130
|
+
promise = request.run_promise do |req|
|
131
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
182
132
|
end
|
183
133
|
|
184
134
|
promise = promise.then do |http_response|
|
185
135
|
status_code = http_response.status
|
186
136
|
response_content = http_response.body
|
187
|
-
unless
|
137
|
+
unless status_code == 200
|
188
138
|
error_model = JSON.load(response_content)
|
189
|
-
fail MsRestAzure::AzureOperationError.new(
|
139
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
190
140
|
end
|
191
141
|
|
192
142
|
# Create Result
|
193
|
-
result = MsRestAzure::AzureOperationResponse.new(
|
143
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
194
144
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
195
145
|
# Deserialize Response
|
196
146
|
if status_code == 200
|
197
147
|
begin
|
198
|
-
parsed_response = JSON.load(response_content)
|
148
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
199
149
|
unless parsed_response.nil?
|
200
|
-
|
150
|
+
deserialized_array = []
|
201
151
|
parsed_response.each do |element|
|
202
152
|
unless element.nil?
|
203
153
|
element = VirtualMachineImageResource.deserialize_object(element)
|
204
154
|
end
|
205
|
-
|
155
|
+
deserialized_array.push(element)
|
206
156
|
end
|
207
|
-
parsed_response =
|
157
|
+
parsed_response = deserialized_array
|
208
158
|
end
|
209
159
|
result.body = parsed_response
|
210
160
|
rescue Exception => e
|
211
|
-
fail MsRest::DeserializationError.new(
|
161
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
212
162
|
end
|
213
163
|
end
|
214
164
|
|
@@ -219,90 +169,66 @@ module Azure::ARM::Compute
|
|
219
169
|
end
|
220
170
|
|
221
171
|
#
|
222
|
-
# Gets a list of virtual machine image
|
172
|
+
# Gets a list of virtual machine image offers.
|
173
|
+
#
|
223
174
|
# @param location [String]
|
175
|
+
# @param publisher_name [String]
|
224
176
|
# @param [Hash{String => String}] The hash of custom headers need to be
|
225
177
|
# applied to HTTP request.
|
226
178
|
#
|
227
179
|
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
228
180
|
# response.
|
229
181
|
#
|
230
|
-
def
|
182
|
+
def list_offers(location, publisher_name, custom_headers = nil)
|
231
183
|
fail ArgumentError, 'location is nil' if location.nil?
|
184
|
+
fail ArgumentError, 'publisher_name is nil' if publisher_name.nil?
|
232
185
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
233
186
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
234
|
-
|
235
|
-
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers"
|
236
|
-
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
237
|
-
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
238
|
-
url = URI.join(@client.base_url, path)
|
239
|
-
properties = {}
|
240
|
-
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
241
|
-
unless url.query.nil?
|
242
|
-
url.query.split('&').each do |url_item|
|
243
|
-
url_items_parts = url_item.split('=')
|
244
|
-
properties[url_items_parts[0]] = url_items_parts[1]
|
245
|
-
end
|
246
|
-
end
|
247
|
-
properties.reject!{ |key, value| value.nil? }
|
248
|
-
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
249
|
-
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
250
|
-
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
251
|
-
url = URI.parse(corrected_url)
|
252
|
-
|
253
|
-
connection = Faraday.new(:url => url) do |faraday|
|
254
|
-
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
255
|
-
faraday.use :cookie_jar
|
256
|
-
faraday.adapter Faraday.default_adapter
|
257
|
-
end
|
258
|
-
request_headers = Hash.new
|
187
|
+
request_headers = {}
|
259
188
|
|
260
189
|
# Set Headers
|
261
190
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
262
|
-
request_headers[
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
promise =
|
272
|
-
|
273
|
-
request.headers = request_headers
|
274
|
-
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
275
|
-
end
|
191
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
192
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers'
|
193
|
+
options = {
|
194
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
195
|
+
path_params: {'location' => location,'publisherName' => publisher_name,'subscriptionId' => @client.subscription_id},
|
196
|
+
query_params: {'api-version' => @client.api_version},
|
197
|
+
headers: request_headers.merge(custom_headers || {})
|
198
|
+
}
|
199
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
200
|
+
promise = request.run_promise do |req|
|
201
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
276
202
|
end
|
277
203
|
|
278
204
|
promise = promise.then do |http_response|
|
279
205
|
status_code = http_response.status
|
280
206
|
response_content = http_response.body
|
281
|
-
unless
|
207
|
+
unless status_code == 200
|
282
208
|
error_model = JSON.load(response_content)
|
283
|
-
fail MsRestAzure::AzureOperationError.new(
|
209
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
284
210
|
end
|
285
211
|
|
286
212
|
# Create Result
|
287
|
-
result = MsRestAzure::AzureOperationResponse.new(
|
213
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
288
214
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
289
215
|
# Deserialize Response
|
290
216
|
if status_code == 200
|
291
217
|
begin
|
292
|
-
parsed_response = JSON.load(response_content)
|
218
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
293
219
|
unless parsed_response.nil?
|
294
|
-
|
220
|
+
deserialized_array = []
|
295
221
|
parsed_response.each do |element|
|
296
222
|
unless element.nil?
|
297
223
|
element = VirtualMachineImageResource.deserialize_object(element)
|
298
224
|
end
|
299
|
-
|
225
|
+
deserialized_array.push(element)
|
300
226
|
end
|
301
|
-
parsed_response =
|
227
|
+
parsed_response = deserialized_array
|
302
228
|
end
|
303
229
|
result.body = parsed_response
|
304
230
|
rescue Exception => e
|
305
|
-
fail MsRest::DeserializationError.new(
|
231
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
306
232
|
end
|
307
233
|
end
|
308
234
|
|
@@ -313,96 +239,64 @@ module Azure::ARM::Compute
|
|
313
239
|
end
|
314
240
|
|
315
241
|
#
|
316
|
-
# Gets a list of virtual machine image
|
242
|
+
# Gets a list of virtual machine image publishers.
|
243
|
+
#
|
317
244
|
# @param location [String]
|
318
|
-
# @param publisher_name [String]
|
319
|
-
# @param offer [String]
|
320
245
|
# @param [Hash{String => String}] The hash of custom headers need to be
|
321
246
|
# applied to HTTP request.
|
322
247
|
#
|
323
248
|
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
324
249
|
# response.
|
325
250
|
#
|
326
|
-
def
|
251
|
+
def list_publishers(location, custom_headers = nil)
|
327
252
|
fail ArgumentError, 'location is nil' if location.nil?
|
328
|
-
fail ArgumentError, 'publisher_name is nil' if publisher_name.nil?
|
329
|
-
fail ArgumentError, 'offer is nil' if offer.nil?
|
330
253
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
331
254
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
332
|
-
|
333
|
-
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus"
|
334
|
-
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
335
|
-
path['{publisherName}'] = ERB::Util.url_encode(publisher_name) if path.include?('{publisherName}')
|
336
|
-
path['{offer}'] = ERB::Util.url_encode(offer) if path.include?('{offer}')
|
337
|
-
path['{subscriptionId}'] = ERB::Util.url_encode(@client.subscription_id) if path.include?('{subscriptionId}')
|
338
|
-
url = URI.join(@client.base_url, path)
|
339
|
-
properties = {}
|
340
|
-
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
341
|
-
unless url.query.nil?
|
342
|
-
url.query.split('&').each do |url_item|
|
343
|
-
url_items_parts = url_item.split('=')
|
344
|
-
properties[url_items_parts[0]] = url_items_parts[1]
|
345
|
-
end
|
346
|
-
end
|
347
|
-
properties.reject!{ |key, value| value.nil? }
|
348
|
-
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
349
|
-
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
350
|
-
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
351
|
-
url = URI.parse(corrected_url)
|
352
|
-
|
353
|
-
connection = Faraday.new(:url => url) do |faraday|
|
354
|
-
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
355
|
-
faraday.use :cookie_jar
|
356
|
-
faraday.adapter Faraday.default_adapter
|
357
|
-
end
|
358
|
-
request_headers = Hash.new
|
255
|
+
request_headers = {}
|
359
256
|
|
360
257
|
# Set Headers
|
361
258
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
362
|
-
request_headers[
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
promise =
|
372
|
-
|
373
|
-
request.headers = request_headers
|
374
|
-
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
375
|
-
end
|
259
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
260
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers'
|
261
|
+
options = {
|
262
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
263
|
+
path_params: {'location' => location,'subscriptionId' => @client.subscription_id},
|
264
|
+
query_params: {'api-version' => @client.api_version},
|
265
|
+
headers: request_headers.merge(custom_headers || {})
|
266
|
+
}
|
267
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
268
|
+
promise = request.run_promise do |req|
|
269
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
376
270
|
end
|
377
271
|
|
378
272
|
promise = promise.then do |http_response|
|
379
273
|
status_code = http_response.status
|
380
274
|
response_content = http_response.body
|
381
|
-
unless
|
275
|
+
unless status_code == 200
|
382
276
|
error_model = JSON.load(response_content)
|
383
|
-
fail MsRestAzure::AzureOperationError.new(
|
277
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
384
278
|
end
|
385
279
|
|
386
280
|
# Create Result
|
387
|
-
result = MsRestAzure::AzureOperationResponse.new(
|
281
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
388
282
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
389
283
|
# Deserialize Response
|
390
284
|
if status_code == 200
|
391
285
|
begin
|
392
|
-
parsed_response = JSON.load(response_content)
|
286
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
393
287
|
unless parsed_response.nil?
|
394
|
-
|
288
|
+
deserialized_array = []
|
395
289
|
parsed_response.each do |element|
|
396
290
|
unless element.nil?
|
397
291
|
element = VirtualMachineImageResource.deserialize_object(element)
|
398
292
|
end
|
399
|
-
|
293
|
+
deserialized_array.push(element)
|
400
294
|
end
|
401
|
-
parsed_response =
|
295
|
+
parsed_response = deserialized_array
|
402
296
|
end
|
403
297
|
result.body = parsed_response
|
404
298
|
rescue Exception => e
|
405
|
-
fail MsRest::DeserializationError.new(
|
299
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
406
300
|
end
|
407
301
|
end
|
408
302
|
|
@@ -413,105 +307,68 @@ module Azure::ARM::Compute
|
|
413
307
|
end
|
414
308
|
|
415
309
|
#
|
416
|
-
# Gets a list of virtual machine
|
310
|
+
# Gets a list of virtual machine image skus.
|
311
|
+
#
|
417
312
|
# @param location [String]
|
418
313
|
# @param publisher_name [String]
|
419
314
|
# @param offer [String]
|
420
|
-
# @param skus [String]
|
421
|
-
# @param filter [String] The filter to apply on the operation.
|
422
|
-
# @param top [Integer]
|
423
|
-
# @param orderby [String]
|
424
315
|
# @param [Hash{String => String}] The hash of custom headers need to be
|
425
316
|
# applied to HTTP request.
|
426
317
|
#
|
427
318
|
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
428
319
|
# response.
|
429
320
|
#
|
430
|
-
def
|
321
|
+
def list_skus(location, publisher_name, offer, custom_headers = nil)
|
431
322
|
fail ArgumentError, 'location is nil' if location.nil?
|
432
323
|
fail ArgumentError, 'publisher_name is nil' if publisher_name.nil?
|
433
324
|
fail ArgumentError, 'offer is nil' if offer.nil?
|
434
|
-
fail ArgumentError, 'skus is nil' if skus.nil?
|
435
325
|
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
436
326
|
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
437
|
-
|
438
|
-
path = "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus/{skus}/versions"
|
439
|
-
path['{location}'] = ERB::Util.url_encode(location) if path.include?('{location}')
|
440
|
-
path['{publisherName}'] = ERB::Util.url_encode(publisher_name) if path.include?('{publisherName}')
|
441
|
-
path['{offer}'] = ERB::Util.url_encode(offer) if path.include?('{offer}')
|
442
|
-
path['{skus}'] = ERB::Util.url_encode(skus) if path.include?('{skus}')
|
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['$orderby'] = ERB::Util.url_encode(orderby.to_s) unless orderby.nil?
|
449
|
-
properties['api-version'] = ERB::Util.url_encode(@client.api_version.to_s) unless @client.api_version.nil?
|
450
|
-
unless url.query.nil?
|
451
|
-
url.query.split('&').each do |url_item|
|
452
|
-
url_items_parts = url_item.split('=')
|
453
|
-
properties[url_items_parts[0]] = url_items_parts[1]
|
454
|
-
end
|
455
|
-
end
|
456
|
-
properties.reject!{ |key, value| value.nil? }
|
457
|
-
url.query = properties.map{ |key, value| "#{key}=#{value}" }.compact.join('&')
|
458
|
-
fail URI::Error unless url.to_s =~ /\A#{URI::regexp}\z/
|
459
|
-
corrected_url = url.to_s.gsub(/([^:])\/\//, '\1/')
|
460
|
-
url = URI.parse(corrected_url)
|
461
|
-
|
462
|
-
connection = Faraday.new(:url => url) do |faraday|
|
463
|
-
faraday.use MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02
|
464
|
-
faraday.use :cookie_jar
|
465
|
-
faraday.adapter Faraday.default_adapter
|
466
|
-
end
|
467
|
-
request_headers = Hash.new
|
327
|
+
request_headers = {}
|
468
328
|
|
469
329
|
# Set Headers
|
470
330
|
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
471
|
-
request_headers[
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
promise =
|
481
|
-
|
482
|
-
request.headers = request_headers
|
483
|
-
@client.credentials.sign_request(request) unless @client.credentials.nil?
|
484
|
-
end
|
331
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
332
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/publishers/{publisherName}/artifacttypes/vmimage/offers/{offer}/skus'
|
333
|
+
options = {
|
334
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
335
|
+
path_params: {'location' => location,'publisherName' => publisher_name,'offer' => offer,'subscriptionId' => @client.subscription_id},
|
336
|
+
query_params: {'api-version' => @client.api_version},
|
337
|
+
headers: request_headers.merge(custom_headers || {})
|
338
|
+
}
|
339
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
340
|
+
promise = request.run_promise do |req|
|
341
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
485
342
|
end
|
486
343
|
|
487
344
|
promise = promise.then do |http_response|
|
488
345
|
status_code = http_response.status
|
489
346
|
response_content = http_response.body
|
490
|
-
unless
|
347
|
+
unless status_code == 200
|
491
348
|
error_model = JSON.load(response_content)
|
492
|
-
fail MsRestAzure::AzureOperationError.new(
|
349
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
493
350
|
end
|
494
351
|
|
495
352
|
# Create Result
|
496
|
-
result = MsRestAzure::AzureOperationResponse.new(
|
353
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
497
354
|
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
498
355
|
# Deserialize Response
|
499
356
|
if status_code == 200
|
500
357
|
begin
|
501
|
-
parsed_response = JSON.load(response_content)
|
358
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
502
359
|
unless parsed_response.nil?
|
503
|
-
|
360
|
+
deserialized_array = []
|
504
361
|
parsed_response.each do |element|
|
505
362
|
unless element.nil?
|
506
363
|
element = VirtualMachineImageResource.deserialize_object(element)
|
507
364
|
end
|
508
|
-
|
365
|
+
deserialized_array.push(element)
|
509
366
|
end
|
510
|
-
parsed_response =
|
367
|
+
parsed_response = deserialized_array
|
511
368
|
end
|
512
369
|
result.body = parsed_response
|
513
370
|
rescue Exception => e
|
514
|
-
fail MsRest::DeserializationError.new(
|
371
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
515
372
|
end
|
516
373
|
end
|
517
374
|
|