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