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
@@ -0,0 +1,1327 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::ARM::Compute
|
7
|
+
#
|
8
|
+
# The Compute Management Client.
|
9
|
+
#
|
10
|
+
class VirtualMachineScaleSets
|
11
|
+
include Azure::ARM::Compute::Models
|
12
|
+
include MsRestAzure
|
13
|
+
|
14
|
+
#
|
15
|
+
# Creates and initializes a new instance of the VirtualMachineScaleSets 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 ComputeManagementClient
|
23
|
+
attr_reader :client
|
24
|
+
|
25
|
+
#
|
26
|
+
# The operation to create or update a virtual machine scale set.
|
27
|
+
#
|
28
|
+
# @param resource_group_name [String] The name of the resource group.
|
29
|
+
# @param name [String] Parameters supplied to the Create Virtual Machine Scale
|
30
|
+
# Set operation.
|
31
|
+
# @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create
|
32
|
+
# Virtual Machine Scale Set operation.
|
33
|
+
# @param @client.api_version [String] Client Api Version.
|
34
|
+
# @param @client.subscription_id [String] Gets subscription credentials which
|
35
|
+
# uniquely identify Microsoft Azure subscription. The subscription ID forms
|
36
|
+
# part of the URI for every service call.
|
37
|
+
# @param @client.accept_language [String] Gets or sets the preferred language
|
38
|
+
# for the response.
|
39
|
+
#
|
40
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
41
|
+
# response.
|
42
|
+
#
|
43
|
+
def create_or_update(resource_group_name, name, parameters, custom_headers = nil)
|
44
|
+
# Send request
|
45
|
+
promise = begin_create_or_update(resource_group_name, name, parameters, custom_headers)
|
46
|
+
|
47
|
+
promise = promise.then do |response|
|
48
|
+
# Defining deserialization method.
|
49
|
+
deserialize_method = lambda do |parsed_response|
|
50
|
+
unless parsed_response.nil?
|
51
|
+
parsed_response = VirtualMachineScaleSet.deserialize_object(parsed_response)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# Waiting for response.
|
56
|
+
@client.get_put_operation_result(response, deserialize_method)
|
57
|
+
end
|
58
|
+
|
59
|
+
promise
|
60
|
+
end
|
61
|
+
|
62
|
+
#
|
63
|
+
# The operation to create or update a virtual machine scale set.
|
64
|
+
#
|
65
|
+
# @param resource_group_name [String] The name of the resource group.
|
66
|
+
# @param name [String] Parameters supplied to the Create Virtual Machine Scale
|
67
|
+
# Set operation.
|
68
|
+
# @param parameters [VirtualMachineScaleSet] Parameters supplied to the Create
|
69
|
+
# Virtual Machine Scale Set operation.
|
70
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
71
|
+
# applied to HTTP request.
|
72
|
+
#
|
73
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
74
|
+
# response.
|
75
|
+
#
|
76
|
+
def begin_create_or_update(resource_group_name, name, parameters, custom_headers = nil)
|
77
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
78
|
+
fail ArgumentError, 'name is nil' if name.nil?
|
79
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
80
|
+
parameters.validate unless parameters.nil?
|
81
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
82
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
83
|
+
request_headers = {}
|
84
|
+
|
85
|
+
# Set Headers
|
86
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
87
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
88
|
+
|
89
|
+
# Serialize Request
|
90
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
91
|
+
unless parameters.nil?
|
92
|
+
parameters = VirtualMachineScaleSet.serialize_object(parameters)
|
93
|
+
end
|
94
|
+
request_content = JSON.generate(parameters, quirks_mode: true)
|
95
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{name}'
|
96
|
+
options = {
|
97
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
98
|
+
path_params: {'resourceGroupName' => resource_group_name,'name' => name,'subscriptionId' => @client.subscription_id},
|
99
|
+
query_params: {'api-version' => @client.api_version},
|
100
|
+
body: request_content,
|
101
|
+
headers: request_headers.merge(custom_headers || {})
|
102
|
+
}
|
103
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :put, options)
|
104
|
+
promise = request.run_promise do |req|
|
105
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
106
|
+
end
|
107
|
+
|
108
|
+
promise = promise.then do |http_response|
|
109
|
+
status_code = http_response.status
|
110
|
+
response_content = http_response.body
|
111
|
+
unless status_code == 200 || status_code == 201
|
112
|
+
error_model = JSON.load(response_content)
|
113
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Create Result
|
117
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
118
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
119
|
+
# Deserialize Response
|
120
|
+
if status_code == 200
|
121
|
+
begin
|
122
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
123
|
+
unless parsed_response.nil?
|
124
|
+
parsed_response = VirtualMachineScaleSet.deserialize_object(parsed_response)
|
125
|
+
end
|
126
|
+
result.body = parsed_response
|
127
|
+
rescue Exception => e
|
128
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
# Deserialize Response
|
132
|
+
if status_code == 201
|
133
|
+
begin
|
134
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
135
|
+
unless parsed_response.nil?
|
136
|
+
parsed_response = VirtualMachineScaleSet.deserialize_object(parsed_response)
|
137
|
+
end
|
138
|
+
result.body = parsed_response
|
139
|
+
rescue Exception => e
|
140
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
result
|
145
|
+
end
|
146
|
+
|
147
|
+
promise.execute
|
148
|
+
end
|
149
|
+
|
150
|
+
#
|
151
|
+
# The operation to deallocate virtual machines in a virtual machine scale set.
|
152
|
+
#
|
153
|
+
# @param resource_group_name [String] The name of the resource group.
|
154
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
155
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
156
|
+
# virtual machine scale set instance IDs.
|
157
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
158
|
+
# response.
|
159
|
+
#
|
160
|
+
def deallocate(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
161
|
+
# Send request
|
162
|
+
promise = begin_deallocate(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
163
|
+
|
164
|
+
promise = promise.then do |response|
|
165
|
+
# Defining deserialization method.
|
166
|
+
deserialize_method = lambda do |parsed_response|
|
167
|
+
end
|
168
|
+
|
169
|
+
# Waiting for response.
|
170
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
171
|
+
end
|
172
|
+
|
173
|
+
promise
|
174
|
+
end
|
175
|
+
|
176
|
+
#
|
177
|
+
# The operation to deallocate virtual machines in a virtual machine scale set.
|
178
|
+
#
|
179
|
+
# @param resource_group_name [String] The name of the resource group.
|
180
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
181
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
182
|
+
# virtual machine scale set instance IDs.
|
183
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
184
|
+
# applied to HTTP request.
|
185
|
+
#
|
186
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
187
|
+
# response.
|
188
|
+
#
|
189
|
+
def begin_deallocate(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
190
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
191
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
192
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
193
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
194
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
195
|
+
request_headers = {}
|
196
|
+
|
197
|
+
# Set Headers
|
198
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
199
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
200
|
+
|
201
|
+
# Serialize Request
|
202
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
203
|
+
unless vm_instance_ids.nil?
|
204
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceIDs.serialize_object(vm_instance_ids)
|
205
|
+
end
|
206
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
207
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/deallocate'
|
208
|
+
options = {
|
209
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
210
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
211
|
+
query_params: {'api-version' => @client.api_version},
|
212
|
+
body: request_content,
|
213
|
+
headers: request_headers.merge(custom_headers || {})
|
214
|
+
}
|
215
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
216
|
+
promise = request.run_promise do |req|
|
217
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
218
|
+
end
|
219
|
+
|
220
|
+
promise = promise.then do |http_response|
|
221
|
+
status_code = http_response.status
|
222
|
+
response_content = http_response.body
|
223
|
+
unless status_code == 202
|
224
|
+
error_model = JSON.load(response_content)
|
225
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
226
|
+
end
|
227
|
+
|
228
|
+
# Create Result
|
229
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
230
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
231
|
+
|
232
|
+
result
|
233
|
+
end
|
234
|
+
|
235
|
+
promise.execute
|
236
|
+
end
|
237
|
+
|
238
|
+
#
|
239
|
+
# The operation to delete a virtual machine scale set.
|
240
|
+
#
|
241
|
+
# @param resource_group_name [String] The name of the resource group.
|
242
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
243
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
244
|
+
# response.
|
245
|
+
#
|
246
|
+
def delete(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
247
|
+
# Send request
|
248
|
+
promise = begin_delete(resource_group_name, vm_scale_set_name, custom_headers)
|
249
|
+
|
250
|
+
promise = promise.then do |response|
|
251
|
+
# Defining deserialization method.
|
252
|
+
deserialize_method = lambda do |parsed_response|
|
253
|
+
end
|
254
|
+
|
255
|
+
# Waiting for response.
|
256
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
257
|
+
end
|
258
|
+
|
259
|
+
promise
|
260
|
+
end
|
261
|
+
|
262
|
+
#
|
263
|
+
# The operation to delete a virtual machine scale set.
|
264
|
+
#
|
265
|
+
# @param resource_group_name [String] The name of the resource group.
|
266
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
267
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
268
|
+
# applied to HTTP request.
|
269
|
+
#
|
270
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
271
|
+
# response.
|
272
|
+
#
|
273
|
+
def begin_delete(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
274
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
275
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
276
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
277
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
278
|
+
request_headers = {}
|
279
|
+
|
280
|
+
# Set Headers
|
281
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
282
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
283
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'
|
284
|
+
options = {
|
285
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
286
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
287
|
+
query_params: {'api-version' => @client.api_version},
|
288
|
+
headers: request_headers.merge(custom_headers || {})
|
289
|
+
}
|
290
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
|
291
|
+
promise = request.run_promise do |req|
|
292
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
293
|
+
end
|
294
|
+
|
295
|
+
promise = promise.then do |http_response|
|
296
|
+
status_code = http_response.status
|
297
|
+
response_content = http_response.body
|
298
|
+
unless status_code == 200 || status_code == 202 || status_code == 204
|
299
|
+
error_model = JSON.load(response_content)
|
300
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
301
|
+
end
|
302
|
+
|
303
|
+
# Create Result
|
304
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
305
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
306
|
+
|
307
|
+
result
|
308
|
+
end
|
309
|
+
|
310
|
+
promise.execute
|
311
|
+
end
|
312
|
+
|
313
|
+
#
|
314
|
+
# The operation to get a virtual machine scale set.
|
315
|
+
#
|
316
|
+
# @param resource_group_name [String] The name of the resource group.
|
317
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
318
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
319
|
+
# applied to HTTP request.
|
320
|
+
#
|
321
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
322
|
+
# response.
|
323
|
+
#
|
324
|
+
def get(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
325
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
326
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
327
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
328
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
329
|
+
request_headers = {}
|
330
|
+
|
331
|
+
# Set Headers
|
332
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
333
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
334
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}'
|
335
|
+
options = {
|
336
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
337
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
338
|
+
query_params: {'api-version' => @client.api_version},
|
339
|
+
headers: request_headers.merge(custom_headers || {})
|
340
|
+
}
|
341
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
342
|
+
promise = request.run_promise do |req|
|
343
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
344
|
+
end
|
345
|
+
|
346
|
+
promise = promise.then do |http_response|
|
347
|
+
status_code = http_response.status
|
348
|
+
response_content = http_response.body
|
349
|
+
unless status_code == 200
|
350
|
+
error_model = JSON.load(response_content)
|
351
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
352
|
+
end
|
353
|
+
|
354
|
+
# Create Result
|
355
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
356
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
357
|
+
# Deserialize Response
|
358
|
+
if status_code == 200
|
359
|
+
begin
|
360
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
361
|
+
unless parsed_response.nil?
|
362
|
+
parsed_response = VirtualMachineScaleSet.deserialize_object(parsed_response)
|
363
|
+
end
|
364
|
+
result.body = parsed_response
|
365
|
+
rescue Exception => e
|
366
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
370
|
+
result
|
371
|
+
end
|
372
|
+
|
373
|
+
promise.execute
|
374
|
+
end
|
375
|
+
|
376
|
+
#
|
377
|
+
# The operation to delete virtual machines in a virtual machine scale set.
|
378
|
+
#
|
379
|
+
# @param resource_group_name [String] The name of the resource group.
|
380
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
381
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The
|
382
|
+
# list of virtual machine scale set instance IDs.
|
383
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
384
|
+
# response.
|
385
|
+
#
|
386
|
+
def delete_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil)
|
387
|
+
# Send request
|
388
|
+
promise = begin_delete_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
389
|
+
|
390
|
+
promise = promise.then do |response|
|
391
|
+
# Defining deserialization method.
|
392
|
+
deserialize_method = lambda do |parsed_response|
|
393
|
+
end
|
394
|
+
|
395
|
+
# Waiting for response.
|
396
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
397
|
+
end
|
398
|
+
|
399
|
+
promise
|
400
|
+
end
|
401
|
+
|
402
|
+
#
|
403
|
+
# The operation to delete virtual machines in a virtual machine scale set.
|
404
|
+
#
|
405
|
+
# @param resource_group_name [String] The name of the resource group.
|
406
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
407
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The
|
408
|
+
# list of virtual machine scale set instance IDs.
|
409
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
410
|
+
# applied to HTTP request.
|
411
|
+
#
|
412
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
413
|
+
# response.
|
414
|
+
#
|
415
|
+
def begin_delete_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil)
|
416
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
417
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
418
|
+
fail ArgumentError, 'vm_instance_ids is nil' if vm_instance_ids.nil?
|
419
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
420
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
421
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
422
|
+
request_headers = {}
|
423
|
+
|
424
|
+
# Set Headers
|
425
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
426
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
427
|
+
|
428
|
+
# Serialize Request
|
429
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
430
|
+
unless vm_instance_ids.nil?
|
431
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs.serialize_object(vm_instance_ids)
|
432
|
+
end
|
433
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
434
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/delete'
|
435
|
+
options = {
|
436
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
437
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
438
|
+
query_params: {'api-version' => @client.api_version},
|
439
|
+
body: request_content,
|
440
|
+
headers: request_headers.merge(custom_headers || {})
|
441
|
+
}
|
442
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
443
|
+
promise = request.run_promise do |req|
|
444
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
445
|
+
end
|
446
|
+
|
447
|
+
promise = promise.then do |http_response|
|
448
|
+
status_code = http_response.status
|
449
|
+
response_content = http_response.body
|
450
|
+
unless status_code == 202
|
451
|
+
error_model = JSON.load(response_content)
|
452
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
453
|
+
end
|
454
|
+
|
455
|
+
# Create Result
|
456
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
457
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
458
|
+
|
459
|
+
result
|
460
|
+
end
|
461
|
+
|
462
|
+
promise.execute
|
463
|
+
end
|
464
|
+
|
465
|
+
#
|
466
|
+
# The operation to get a virtual machine scale set instance view.
|
467
|
+
#
|
468
|
+
# @param resource_group_name [String] The name of the resource group.
|
469
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
470
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
471
|
+
# applied to HTTP request.
|
472
|
+
#
|
473
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
474
|
+
# response.
|
475
|
+
#
|
476
|
+
def get_instance_view(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
477
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
478
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
479
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
480
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
481
|
+
request_headers = {}
|
482
|
+
|
483
|
+
# Set Headers
|
484
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
485
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
486
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/instanceView'
|
487
|
+
options = {
|
488
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
489
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
490
|
+
query_params: {'api-version' => @client.api_version},
|
491
|
+
headers: request_headers.merge(custom_headers || {})
|
492
|
+
}
|
493
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
494
|
+
promise = request.run_promise do |req|
|
495
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
496
|
+
end
|
497
|
+
|
498
|
+
promise = promise.then do |http_response|
|
499
|
+
status_code = http_response.status
|
500
|
+
response_content = http_response.body
|
501
|
+
unless status_code == 200
|
502
|
+
error_model = JSON.load(response_content)
|
503
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
504
|
+
end
|
505
|
+
|
506
|
+
# Create Result
|
507
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
508
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
509
|
+
# Deserialize Response
|
510
|
+
if status_code == 200
|
511
|
+
begin
|
512
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
513
|
+
unless parsed_response.nil?
|
514
|
+
parsed_response = VirtualMachineScaleSetInstanceView.deserialize_object(parsed_response)
|
515
|
+
end
|
516
|
+
result.body = parsed_response
|
517
|
+
rescue Exception => e
|
518
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
result
|
523
|
+
end
|
524
|
+
|
525
|
+
promise.execute
|
526
|
+
end
|
527
|
+
|
528
|
+
#
|
529
|
+
# The operation to list virtual machine scale sets under a resource group.
|
530
|
+
#
|
531
|
+
# @param resource_group_name [String] The name of the resource group.
|
532
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
533
|
+
# applied to HTTP request.
|
534
|
+
#
|
535
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
536
|
+
# response.
|
537
|
+
#
|
538
|
+
def list(resource_group_name, custom_headers = nil)
|
539
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
540
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
541
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
542
|
+
request_headers = {}
|
543
|
+
|
544
|
+
# Set Headers
|
545
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
546
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
547
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets'
|
548
|
+
options = {
|
549
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
550
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
551
|
+
query_params: {'api-version' => @client.api_version},
|
552
|
+
headers: request_headers.merge(custom_headers || {})
|
553
|
+
}
|
554
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
555
|
+
promise = request.run_promise do |req|
|
556
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
557
|
+
end
|
558
|
+
|
559
|
+
promise = promise.then do |http_response|
|
560
|
+
status_code = http_response.status
|
561
|
+
response_content = http_response.body
|
562
|
+
unless status_code == 200
|
563
|
+
error_model = JSON.load(response_content)
|
564
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
565
|
+
end
|
566
|
+
|
567
|
+
# Create Result
|
568
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
569
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
570
|
+
# Deserialize Response
|
571
|
+
if status_code == 200
|
572
|
+
begin
|
573
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
574
|
+
unless parsed_response.nil?
|
575
|
+
parsed_response = VirtualMachineScaleSetListResult.deserialize_object(parsed_response)
|
576
|
+
end
|
577
|
+
result.body = parsed_response
|
578
|
+
rescue Exception => e
|
579
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
result
|
584
|
+
end
|
585
|
+
|
586
|
+
promise.execute
|
587
|
+
end
|
588
|
+
|
589
|
+
#
|
590
|
+
# Gets the list of Virtual Machine Scale Sets in the subscription. Use
|
591
|
+
# nextLink property in the response to get the next page of Virtual Machine
|
592
|
+
# Scale Sets. Do this till nextLink is not null to fetch all the Virtual
|
593
|
+
# Machine Scale Sets.
|
594
|
+
#
|
595
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
596
|
+
# applied to HTTP request.
|
597
|
+
#
|
598
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
599
|
+
# response.
|
600
|
+
#
|
601
|
+
def list_all(custom_headers = nil)
|
602
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
603
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
604
|
+
request_headers = {}
|
605
|
+
|
606
|
+
# Set Headers
|
607
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
608
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
609
|
+
path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Compute/virtualMachineScaleSets'
|
610
|
+
options = {
|
611
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
612
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
613
|
+
query_params: {'api-version' => @client.api_version},
|
614
|
+
headers: request_headers.merge(custom_headers || {})
|
615
|
+
}
|
616
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
617
|
+
promise = request.run_promise do |req|
|
618
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
619
|
+
end
|
620
|
+
|
621
|
+
promise = promise.then do |http_response|
|
622
|
+
status_code = http_response.status
|
623
|
+
response_content = http_response.body
|
624
|
+
unless status_code == 200
|
625
|
+
error_model = JSON.load(response_content)
|
626
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
627
|
+
end
|
628
|
+
|
629
|
+
# Create Result
|
630
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
631
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
632
|
+
# Deserialize Response
|
633
|
+
if status_code == 200
|
634
|
+
begin
|
635
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
636
|
+
unless parsed_response.nil?
|
637
|
+
parsed_response = VirtualMachineScaleSetListWithLinkResult.deserialize_object(parsed_response)
|
638
|
+
end
|
639
|
+
result.body = parsed_response
|
640
|
+
rescue Exception => e
|
641
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
642
|
+
end
|
643
|
+
end
|
644
|
+
|
645
|
+
result
|
646
|
+
end
|
647
|
+
|
648
|
+
promise.execute
|
649
|
+
end
|
650
|
+
|
651
|
+
#
|
652
|
+
# The operation to list available skus for a virtual machine scale set.
|
653
|
+
#
|
654
|
+
# @param resource_group_name [String] The name of the resource group.
|
655
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
656
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
657
|
+
# applied to HTTP request.
|
658
|
+
#
|
659
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
660
|
+
# response.
|
661
|
+
#
|
662
|
+
def list_skus(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
663
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
664
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
665
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
666
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
667
|
+
request_headers = {}
|
668
|
+
|
669
|
+
# Set Headers
|
670
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
671
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
672
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/skus'
|
673
|
+
options = {
|
674
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
675
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
676
|
+
query_params: {'api-version' => @client.api_version},
|
677
|
+
headers: request_headers.merge(custom_headers || {})
|
678
|
+
}
|
679
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
680
|
+
promise = request.run_promise do |req|
|
681
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
682
|
+
end
|
683
|
+
|
684
|
+
promise = promise.then do |http_response|
|
685
|
+
status_code = http_response.status
|
686
|
+
response_content = http_response.body
|
687
|
+
unless status_code == 200
|
688
|
+
error_model = JSON.load(response_content)
|
689
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
690
|
+
end
|
691
|
+
|
692
|
+
# Create Result
|
693
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
694
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
695
|
+
# Deserialize Response
|
696
|
+
if status_code == 200
|
697
|
+
begin
|
698
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
699
|
+
unless parsed_response.nil?
|
700
|
+
parsed_response = VirtualMachineScaleSetListSkusResult.deserialize_object(parsed_response)
|
701
|
+
end
|
702
|
+
result.body = parsed_response
|
703
|
+
rescue Exception => e
|
704
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
705
|
+
end
|
706
|
+
end
|
707
|
+
|
708
|
+
result
|
709
|
+
end
|
710
|
+
|
711
|
+
promise.execute
|
712
|
+
end
|
713
|
+
|
714
|
+
#
|
715
|
+
# The operation to power off (stop) virtual machines in a virtual machine
|
716
|
+
# scale set.
|
717
|
+
#
|
718
|
+
# @param resource_group_name [String] The name of the resource group.
|
719
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
720
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
721
|
+
# virtual machine scale set instance IDs.
|
722
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
723
|
+
# response.
|
724
|
+
#
|
725
|
+
def power_off(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
726
|
+
# Send request
|
727
|
+
promise = begin_power_off(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
728
|
+
|
729
|
+
promise = promise.then do |response|
|
730
|
+
# Defining deserialization method.
|
731
|
+
deserialize_method = lambda do |parsed_response|
|
732
|
+
end
|
733
|
+
|
734
|
+
# Waiting for response.
|
735
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
736
|
+
end
|
737
|
+
|
738
|
+
promise
|
739
|
+
end
|
740
|
+
|
741
|
+
#
|
742
|
+
# The operation to power off (stop) virtual machines in a virtual machine
|
743
|
+
# scale set.
|
744
|
+
#
|
745
|
+
# @param resource_group_name [String] The name of the resource group.
|
746
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
747
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
748
|
+
# virtual machine scale set instance IDs.
|
749
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
750
|
+
# applied to HTTP request.
|
751
|
+
#
|
752
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
753
|
+
# response.
|
754
|
+
#
|
755
|
+
def begin_power_off(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
756
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
757
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
758
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
759
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
760
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
761
|
+
request_headers = {}
|
762
|
+
|
763
|
+
# Set Headers
|
764
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
765
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
766
|
+
|
767
|
+
# Serialize Request
|
768
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
769
|
+
unless vm_instance_ids.nil?
|
770
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceIDs.serialize_object(vm_instance_ids)
|
771
|
+
end
|
772
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
773
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/poweroff'
|
774
|
+
options = {
|
775
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
776
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
777
|
+
query_params: {'api-version' => @client.api_version},
|
778
|
+
body: request_content,
|
779
|
+
headers: request_headers.merge(custom_headers || {})
|
780
|
+
}
|
781
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
782
|
+
promise = request.run_promise do |req|
|
783
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
784
|
+
end
|
785
|
+
|
786
|
+
promise = promise.then do |http_response|
|
787
|
+
status_code = http_response.status
|
788
|
+
response_content = http_response.body
|
789
|
+
unless status_code == 202
|
790
|
+
error_model = JSON.load(response_content)
|
791
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
792
|
+
end
|
793
|
+
|
794
|
+
# Create Result
|
795
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
796
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
797
|
+
|
798
|
+
result
|
799
|
+
end
|
800
|
+
|
801
|
+
promise.execute
|
802
|
+
end
|
803
|
+
|
804
|
+
#
|
805
|
+
# The operation to restart virtual machines in a virtual machine scale set.
|
806
|
+
#
|
807
|
+
# @param resource_group_name [String] The name of the resource group.
|
808
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
809
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
810
|
+
# virtual machine scale set instance IDs.
|
811
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
812
|
+
# response.
|
813
|
+
#
|
814
|
+
def restart(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
815
|
+
# Send request
|
816
|
+
promise = begin_restart(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
817
|
+
|
818
|
+
promise = promise.then do |response|
|
819
|
+
# Defining deserialization method.
|
820
|
+
deserialize_method = lambda do |parsed_response|
|
821
|
+
end
|
822
|
+
|
823
|
+
# Waiting for response.
|
824
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
825
|
+
end
|
826
|
+
|
827
|
+
promise
|
828
|
+
end
|
829
|
+
|
830
|
+
#
|
831
|
+
# The operation to restart virtual machines in a virtual machine scale set.
|
832
|
+
#
|
833
|
+
# @param resource_group_name [String] The name of the resource group.
|
834
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
835
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
836
|
+
# virtual machine scale set instance IDs.
|
837
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
838
|
+
# applied to HTTP request.
|
839
|
+
#
|
840
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
841
|
+
# response.
|
842
|
+
#
|
843
|
+
def begin_restart(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
844
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
845
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
846
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
847
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
848
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
849
|
+
request_headers = {}
|
850
|
+
|
851
|
+
# Set Headers
|
852
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
853
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
854
|
+
|
855
|
+
# Serialize Request
|
856
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
857
|
+
unless vm_instance_ids.nil?
|
858
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceIDs.serialize_object(vm_instance_ids)
|
859
|
+
end
|
860
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
861
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/restart'
|
862
|
+
options = {
|
863
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
864
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
865
|
+
query_params: {'api-version' => @client.api_version},
|
866
|
+
body: request_content,
|
867
|
+
headers: request_headers.merge(custom_headers || {})
|
868
|
+
}
|
869
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
870
|
+
promise = request.run_promise do |req|
|
871
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
872
|
+
end
|
873
|
+
|
874
|
+
promise = promise.then do |http_response|
|
875
|
+
status_code = http_response.status
|
876
|
+
response_content = http_response.body
|
877
|
+
unless status_code == 202
|
878
|
+
error_model = JSON.load(response_content)
|
879
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
880
|
+
end
|
881
|
+
|
882
|
+
# Create Result
|
883
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
884
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
885
|
+
|
886
|
+
result
|
887
|
+
end
|
888
|
+
|
889
|
+
promise.execute
|
890
|
+
end
|
891
|
+
|
892
|
+
#
|
893
|
+
# The operation to start virtual machines in a virtual machine scale set.
|
894
|
+
#
|
895
|
+
# @param resource_group_name [String] The name of the resource group.
|
896
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
897
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
898
|
+
# virtual machine scale set instance IDs.
|
899
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
900
|
+
# response.
|
901
|
+
#
|
902
|
+
def start(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
903
|
+
# Send request
|
904
|
+
promise = begin_start(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
905
|
+
|
906
|
+
promise = promise.then do |response|
|
907
|
+
# Defining deserialization method.
|
908
|
+
deserialize_method = lambda do |parsed_response|
|
909
|
+
end
|
910
|
+
|
911
|
+
# Waiting for response.
|
912
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
913
|
+
end
|
914
|
+
|
915
|
+
promise
|
916
|
+
end
|
917
|
+
|
918
|
+
#
|
919
|
+
# The operation to start virtual machines in a virtual machine scale set.
|
920
|
+
#
|
921
|
+
# @param resource_group_name [String] The name of the resource group.
|
922
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
923
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceIDs] The list of
|
924
|
+
# virtual machine scale set instance IDs.
|
925
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
926
|
+
# applied to HTTP request.
|
927
|
+
#
|
928
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
929
|
+
# response.
|
930
|
+
#
|
931
|
+
def begin_start(resource_group_name, vm_scale_set_name, vm_instance_ids = nil, custom_headers = nil)
|
932
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
933
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
934
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
935
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
936
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
937
|
+
request_headers = {}
|
938
|
+
|
939
|
+
# Set Headers
|
940
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
941
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
942
|
+
|
943
|
+
# Serialize Request
|
944
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
945
|
+
unless vm_instance_ids.nil?
|
946
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceIDs.serialize_object(vm_instance_ids)
|
947
|
+
end
|
948
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
949
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/start'
|
950
|
+
options = {
|
951
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
952
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
953
|
+
query_params: {'api-version' => @client.api_version},
|
954
|
+
body: request_content,
|
955
|
+
headers: request_headers.merge(custom_headers || {})
|
956
|
+
}
|
957
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
958
|
+
promise = request.run_promise do |req|
|
959
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
960
|
+
end
|
961
|
+
|
962
|
+
promise = promise.then do |http_response|
|
963
|
+
status_code = http_response.status
|
964
|
+
response_content = http_response.body
|
965
|
+
unless status_code == 202
|
966
|
+
error_model = JSON.load(response_content)
|
967
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
968
|
+
end
|
969
|
+
|
970
|
+
# Create Result
|
971
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
972
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
973
|
+
|
974
|
+
result
|
975
|
+
end
|
976
|
+
|
977
|
+
promise.execute
|
978
|
+
end
|
979
|
+
|
980
|
+
#
|
981
|
+
# The operation to manually upgrade virtual machines in a virtual machine
|
982
|
+
# scale set.
|
983
|
+
#
|
984
|
+
# @param resource_group_name [String] The name of the resource group.
|
985
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
986
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The
|
987
|
+
# list of virtual machine scale set instance IDs.
|
988
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
989
|
+
# response.
|
990
|
+
#
|
991
|
+
def update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil)
|
992
|
+
# Send request
|
993
|
+
promise = begin_update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers)
|
994
|
+
|
995
|
+
promise = promise.then do |response|
|
996
|
+
# Defining deserialization method.
|
997
|
+
deserialize_method = lambda do |parsed_response|
|
998
|
+
end
|
999
|
+
|
1000
|
+
# Waiting for response.
|
1001
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
promise
|
1005
|
+
end
|
1006
|
+
|
1007
|
+
#
|
1008
|
+
# The operation to manually upgrade virtual machines in a virtual machine
|
1009
|
+
# scale set.
|
1010
|
+
#
|
1011
|
+
# @param resource_group_name [String] The name of the resource group.
|
1012
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
1013
|
+
# @param vm_instance_ids [VirtualMachineScaleSetVMInstanceRequiredIDs] The
|
1014
|
+
# list of virtual machine scale set instance IDs.
|
1015
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
1016
|
+
# applied to HTTP request.
|
1017
|
+
#
|
1018
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
1019
|
+
# response.
|
1020
|
+
#
|
1021
|
+
def begin_update_instances(resource_group_name, vm_scale_set_name, vm_instance_ids, custom_headers = nil)
|
1022
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
1023
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
1024
|
+
fail ArgumentError, 'vm_instance_ids is nil' if vm_instance_ids.nil?
|
1025
|
+
vm_instance_ids.validate unless vm_instance_ids.nil?
|
1026
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1027
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
1028
|
+
request_headers = {}
|
1029
|
+
|
1030
|
+
# Set Headers
|
1031
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1032
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1033
|
+
|
1034
|
+
# Serialize Request
|
1035
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
1036
|
+
unless vm_instance_ids.nil?
|
1037
|
+
vm_instance_ids = VirtualMachineScaleSetVMInstanceRequiredIDs.serialize_object(vm_instance_ids)
|
1038
|
+
end
|
1039
|
+
request_content = JSON.generate(vm_instance_ids, quirks_mode: true)
|
1040
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/manualupgrade'
|
1041
|
+
options = {
|
1042
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1043
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
1044
|
+
query_params: {'api-version' => @client.api_version},
|
1045
|
+
body: request_content,
|
1046
|
+
headers: request_headers.merge(custom_headers || {})
|
1047
|
+
}
|
1048
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
1049
|
+
promise = request.run_promise do |req|
|
1050
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
1051
|
+
end
|
1052
|
+
|
1053
|
+
promise = promise.then do |http_response|
|
1054
|
+
status_code = http_response.status
|
1055
|
+
response_content = http_response.body
|
1056
|
+
unless status_code == 202
|
1057
|
+
error_model = JSON.load(response_content)
|
1058
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
1059
|
+
end
|
1060
|
+
|
1061
|
+
# Create Result
|
1062
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
1063
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1064
|
+
|
1065
|
+
result
|
1066
|
+
end
|
1067
|
+
|
1068
|
+
promise.execute
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
#
|
1072
|
+
# The operation to re-image virtual machines in a virtual machine scale set.
|
1073
|
+
#
|
1074
|
+
# @param resource_group_name [String] The name of the resource group.
|
1075
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
1076
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
1077
|
+
# response.
|
1078
|
+
#
|
1079
|
+
def reimage(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
1080
|
+
# Send request
|
1081
|
+
promise = begin_reimage(resource_group_name, vm_scale_set_name, custom_headers)
|
1082
|
+
|
1083
|
+
promise = promise.then do |response|
|
1084
|
+
# Defining deserialization method.
|
1085
|
+
deserialize_method = lambda do |parsed_response|
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
# Waiting for response.
|
1089
|
+
@client.get_post_or_delete_operation_result(response, deserialize_method)
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
promise
|
1093
|
+
end
|
1094
|
+
|
1095
|
+
#
|
1096
|
+
# The operation to re-image virtual machines in a virtual machine scale set.
|
1097
|
+
#
|
1098
|
+
# @param resource_group_name [String] The name of the resource group.
|
1099
|
+
# @param vm_scale_set_name [String] The name of the virtual machine scale set.
|
1100
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
1101
|
+
# applied to HTTP request.
|
1102
|
+
#
|
1103
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
1104
|
+
# response.
|
1105
|
+
#
|
1106
|
+
def begin_reimage(resource_group_name, vm_scale_set_name, custom_headers = nil)
|
1107
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
1108
|
+
fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
|
1109
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
1110
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
1111
|
+
request_headers = {}
|
1112
|
+
|
1113
|
+
# Set Headers
|
1114
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1115
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1116
|
+
path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/reimage'
|
1117
|
+
options = {
|
1118
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1119
|
+
path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'subscriptionId' => @client.subscription_id},
|
1120
|
+
query_params: {'api-version' => @client.api_version},
|
1121
|
+
headers: request_headers.merge(custom_headers || {})
|
1122
|
+
}
|
1123
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
|
1124
|
+
promise = request.run_promise do |req|
|
1125
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
1126
|
+
end
|
1127
|
+
|
1128
|
+
promise = promise.then do |http_response|
|
1129
|
+
status_code = http_response.status
|
1130
|
+
response_content = http_response.body
|
1131
|
+
unless status_code == 202
|
1132
|
+
error_model = JSON.load(response_content)
|
1133
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
1134
|
+
end
|
1135
|
+
|
1136
|
+
# Create Result
|
1137
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
1138
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1139
|
+
|
1140
|
+
result
|
1141
|
+
end
|
1142
|
+
|
1143
|
+
promise.execute
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
#
|
1147
|
+
# The operation to list virtual machine scale sets under a resource group.
|
1148
|
+
#
|
1149
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
1150
|
+
# call to List operation.
|
1151
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
1152
|
+
# applied to HTTP request.
|
1153
|
+
#
|
1154
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
1155
|
+
# response.
|
1156
|
+
#
|
1157
|
+
def list_next(next_page_link, custom_headers = nil)
|
1158
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1159
|
+
request_headers = {}
|
1160
|
+
|
1161
|
+
# Set Headers
|
1162
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1163
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1164
|
+
path_template = '{nextLink}'
|
1165
|
+
options = {
|
1166
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1167
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1168
|
+
headers: request_headers.merge(custom_headers || {})
|
1169
|
+
}
|
1170
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
1171
|
+
promise = request.run_promise do |req|
|
1172
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
1173
|
+
end
|
1174
|
+
|
1175
|
+
promise = promise.then do |http_response|
|
1176
|
+
status_code = http_response.status
|
1177
|
+
response_content = http_response.body
|
1178
|
+
unless status_code == 200
|
1179
|
+
error_model = JSON.load(response_content)
|
1180
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
1181
|
+
end
|
1182
|
+
|
1183
|
+
# Create Result
|
1184
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
1185
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1186
|
+
# Deserialize Response
|
1187
|
+
if status_code == 200
|
1188
|
+
begin
|
1189
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1190
|
+
unless parsed_response.nil?
|
1191
|
+
parsed_response = VirtualMachineScaleSetListResult.deserialize_object(parsed_response)
|
1192
|
+
end
|
1193
|
+
result.body = parsed_response
|
1194
|
+
rescue Exception => e
|
1195
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1196
|
+
end
|
1197
|
+
end
|
1198
|
+
|
1199
|
+
result
|
1200
|
+
end
|
1201
|
+
|
1202
|
+
promise.execute
|
1203
|
+
end
|
1204
|
+
|
1205
|
+
#
|
1206
|
+
# Gets the list of Virtual Machine Scale Sets in the subscription. Use
|
1207
|
+
# nextLink property in the response to get the next page of Virtual Machine
|
1208
|
+
# Scale Sets. Do this till nextLink is not null to fetch all the Virtual
|
1209
|
+
# Machine Scale Sets.
|
1210
|
+
#
|
1211
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
1212
|
+
# call to List operation.
|
1213
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
1214
|
+
# applied to HTTP request.
|
1215
|
+
#
|
1216
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
1217
|
+
# response.
|
1218
|
+
#
|
1219
|
+
def list_all_next(next_page_link, custom_headers = nil)
|
1220
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1221
|
+
request_headers = {}
|
1222
|
+
|
1223
|
+
# Set Headers
|
1224
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1225
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1226
|
+
path_template = '{nextLink}'
|
1227
|
+
options = {
|
1228
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1229
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1230
|
+
headers: request_headers.merge(custom_headers || {})
|
1231
|
+
}
|
1232
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
1233
|
+
promise = request.run_promise do |req|
|
1234
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
1235
|
+
end
|
1236
|
+
|
1237
|
+
promise = promise.then do |http_response|
|
1238
|
+
status_code = http_response.status
|
1239
|
+
response_content = http_response.body
|
1240
|
+
unless status_code == 200
|
1241
|
+
error_model = JSON.load(response_content)
|
1242
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
1243
|
+
end
|
1244
|
+
|
1245
|
+
# Create Result
|
1246
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
1247
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1248
|
+
# Deserialize Response
|
1249
|
+
if status_code == 200
|
1250
|
+
begin
|
1251
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1252
|
+
unless parsed_response.nil?
|
1253
|
+
parsed_response = VirtualMachineScaleSetListWithLinkResult.deserialize_object(parsed_response)
|
1254
|
+
end
|
1255
|
+
result.body = parsed_response
|
1256
|
+
rescue Exception => e
|
1257
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1258
|
+
end
|
1259
|
+
end
|
1260
|
+
|
1261
|
+
result
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
promise.execute
|
1265
|
+
end
|
1266
|
+
|
1267
|
+
#
|
1268
|
+
# The operation to list available skus for a virtual machine scale set.
|
1269
|
+
#
|
1270
|
+
# @param next_page_link [String] The NextLink from the previous successful
|
1271
|
+
# call to List operation.
|
1272
|
+
# @param [Hash{String => String}] The hash of custom headers need to be
|
1273
|
+
# applied to HTTP request.
|
1274
|
+
#
|
1275
|
+
# @return [Concurrent::Promise] Promise object which allows to get HTTP
|
1276
|
+
# response.
|
1277
|
+
#
|
1278
|
+
def list_skus_next(next_page_link, custom_headers = nil)
|
1279
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
1280
|
+
request_headers = {}
|
1281
|
+
|
1282
|
+
# Set Headers
|
1283
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
1284
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
1285
|
+
path_template = '{nextLink}'
|
1286
|
+
options = {
|
1287
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
1288
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
1289
|
+
headers: request_headers.merge(custom_headers || {})
|
1290
|
+
}
|
1291
|
+
request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
|
1292
|
+
promise = request.run_promise do |req|
|
1293
|
+
@client.credentials.sign_request(req) unless @client.credentials.nil?
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
promise = promise.then do |http_response|
|
1297
|
+
status_code = http_response.status
|
1298
|
+
response_content = http_response.body
|
1299
|
+
unless status_code == 200
|
1300
|
+
error_model = JSON.load(response_content)
|
1301
|
+
fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
|
1302
|
+
end
|
1303
|
+
|
1304
|
+
# Create Result
|
1305
|
+
result = MsRestAzure::AzureOperationResponse.new(request, http_response)
|
1306
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
1307
|
+
# Deserialize Response
|
1308
|
+
if status_code == 200
|
1309
|
+
begin
|
1310
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
1311
|
+
unless parsed_response.nil?
|
1312
|
+
parsed_response = VirtualMachineScaleSetListSkusResult.deserialize_object(parsed_response)
|
1313
|
+
end
|
1314
|
+
result.body = parsed_response
|
1315
|
+
rescue Exception => e
|
1316
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
1317
|
+
end
|
1318
|
+
end
|
1319
|
+
|
1320
|
+
result
|
1321
|
+
end
|
1322
|
+
|
1323
|
+
promise.execute
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
end
|
1327
|
+
end
|