azure_mgmt_compute 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/azure_mgmt_compute.gemspec +3 -11
  3. data/lib/azure_mgmt_compute/availability_sets.rb +226 -241
  4. data/lib/azure_mgmt_compute/compute_management_client.rb +26 -11
  5. data/lib/azure_mgmt_compute/models/additional_unattend_content.rb +8 -11
  6. data/lib/azure_mgmt_compute/models/api_entity_reference.rb +58 -0
  7. data/lib/azure_mgmt_compute/models/api_error.rb +4 -6
  8. data/lib/azure_mgmt_compute/models/api_error_base.rb +1 -3
  9. data/lib/azure_mgmt_compute/models/availability_set.rb +1 -3
  10. data/lib/azure_mgmt_compute/models/availability_set_list_result.rb +4 -6
  11. data/lib/azure_mgmt_compute/models/availability_set_properties.rb +9 -11
  12. data/lib/azure_mgmt_compute/models/boot_diagnostics.rb +67 -0
  13. data/lib/azure_mgmt_compute/models/boot_diagnostics_instance_view.rb +65 -0
  14. data/lib/azure_mgmt_compute/models/caching_types.rb +1 -1
  15. data/lib/azure_mgmt_compute/models/component_names.rb +1 -1
  16. data/lib/azure_mgmt_compute/models/compute_long_running_operation_properties.rb +1 -3
  17. data/lib/azure_mgmt_compute/models/compute_long_running_operation_result.rb +3 -6
  18. data/lib/azure_mgmt_compute/models/compute_operation_status.rb +1 -1
  19. data/lib/azure_mgmt_compute/models/data_disk.rb +27 -26
  20. data/lib/azure_mgmt_compute/models/data_disk_image.rb +1 -3
  21. data/lib/azure_mgmt_compute/models/delete_operation_result.rb +6 -5
  22. data/lib/azure_mgmt_compute/models/diagnostics_profile.rb +62 -0
  23. data/lib/azure_mgmt_compute/models/disk_create_option_types.rb +1 -1
  24. data/lib/azure_mgmt_compute/models/disk_encryption_settings.rb +81 -0
  25. data/lib/azure_mgmt_compute/models/disk_instance_view.rb +4 -6
  26. data/lib/azure_mgmt_compute/models/hardware_profile.rb +15 -9
  27. data/lib/azure_mgmt_compute/models/image_reference.rb +1 -3
  28. data/lib/azure_mgmt_compute/models/inner_error.rb +1 -3
  29. data/lib/azure_mgmt_compute/models/instance_view_status.rb +3 -5
  30. data/lib/azure_mgmt_compute/models/key_vault_key_reference.rb +74 -0
  31. data/lib/azure_mgmt_compute/models/key_vault_secret_reference.rb +75 -0
  32. data/lib/azure_mgmt_compute/models/linux_configuration.rb +1 -3
  33. data/lib/azure_mgmt_compute/models/list_usages_result.rb +4 -6
  34. data/lib/azure_mgmt_compute/models/network_interface_reference.rb +1 -3
  35. data/lib/azure_mgmt_compute/models/network_interface_reference_properties.rb +1 -3
  36. data/lib/azure_mgmt_compute/models/network_profile.rb +4 -6
  37. data/lib/azure_mgmt_compute/models/operating_system_types.rb +1 -1
  38. data/lib/azure_mgmt_compute/models/operation_status.rb +1 -1
  39. data/lib/azure_mgmt_compute/models/osdisk.rb +54 -26
  40. data/lib/azure_mgmt_compute/models/osdisk_image.rb +4 -6
  41. data/lib/azure_mgmt_compute/models/osprofile.rb +4 -6
  42. data/lib/azure_mgmt_compute/models/pass_names.rb +1 -1
  43. data/lib/azure_mgmt_compute/models/plan.rb +1 -3
  44. data/lib/azure_mgmt_compute/models/protocol_types.rb +1 -1
  45. data/lib/azure_mgmt_compute/models/purchase_plan.rb +4 -4
  46. data/lib/azure_mgmt_compute/models/setting_names.rb +1 -1
  47. data/lib/azure_mgmt_compute/models/sku.rb +75 -0
  48. data/lib/azure_mgmt_compute/models/ssh_configuration.rb +4 -6
  49. data/lib/azure_mgmt_compute/models/ssh_public_key.rb +1 -3
  50. data/lib/azure_mgmt_compute/models/status_level_types.rb +1 -1
  51. data/lib/azure_mgmt_compute/models/storage_profile.rb +4 -6
  52. data/lib/azure_mgmt_compute/models/{usage_unit.rb → upgrade_mode.rb} +5 -4
  53. data/lib/azure_mgmt_compute/models/upgrade_policy.rb +60 -0
  54. data/lib/azure_mgmt_compute/models/usage.rb +7 -9
  55. data/lib/azure_mgmt_compute/models/usage_name.rb +1 -3
  56. data/lib/azure_mgmt_compute/models/vault_certificate.rb +1 -3
  57. data/lib/azure_mgmt_compute/models/vault_secret_group.rb +6 -8
  58. data/lib/azure_mgmt_compute/models/virtual_hard_disk.rb +1 -3
  59. data/lib/azure_mgmt_compute/models/virtual_machine.rb +4 -6
  60. data/lib/azure_mgmt_compute/models/virtual_machine_agent_instance_view.rb +7 -9
  61. data/lib/azure_mgmt_compute/models/virtual_machine_capture_parameters.rb +4 -4
  62. data/lib/azure_mgmt_compute/models/virtual_machine_capture_result.rb +68 -0
  63. data/lib/azure_mgmt_compute/models/virtual_machine_capture_result_properties.rb +56 -0
  64. data/lib/azure_mgmt_compute/models/virtual_machine_extension.rb +1 -3
  65. data/lib/azure_mgmt_compute/models/virtual_machine_extension_handler_instance_view.rb +1 -3
  66. data/lib/azure_mgmt_compute/models/virtual_machine_extension_image.rb +15 -15
  67. data/lib/azure_mgmt_compute/models/virtual_machine_extension_image_properties.rb +4 -4
  68. data/lib/azure_mgmt_compute/models/virtual_machine_extension_instance_view.rb +7 -9
  69. data/lib/azure_mgmt_compute/models/virtual_machine_extension_properties.rb +11 -3
  70. data/lib/azure_mgmt_compute/models/virtual_machine_image.rb +15 -15
  71. data/lib/azure_mgmt_compute/models/virtual_machine_image_properties.rb +4 -6
  72. data/lib/azure_mgmt_compute/models/virtual_machine_image_resource.rb +9 -9
  73. data/lib/azure_mgmt_compute/models/virtual_machine_instance_view.rb +28 -14
  74. data/lib/azure_mgmt_compute/models/virtual_machine_list_result.rb +4 -6
  75. data/lib/azure_mgmt_compute/models/virtual_machine_properties.rb +29 -5
  76. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set.rb +108 -0
  77. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension.rb +77 -0
  78. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_profile.rb +77 -0
  79. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_extension_properties.rb +116 -0
  80. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view.rb +125 -0
  81. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_instance_view_statuses_summary.rb +79 -0
  82. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration.rb +78 -0
  83. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_ipconfiguration_properties.rb +127 -0
  84. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_result.rb +77 -0
  85. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_skus_result.rb +77 -0
  86. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_list_with_link_result.rb +88 -0
  87. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration.rb +80 -0
  88. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_configuration_properties.rb +89 -0
  89. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_network_profile.rb +77 -0
  90. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osdisk.rb +129 -0
  91. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_osprofile.rb +147 -0
  92. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_properties.rb +89 -0
  93. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku.rb +88 -0
  94. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_capacity.rb +90 -0
  95. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_sku_scale_type.rb +16 -0
  96. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_storage_profile.rb +78 -0
  97. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vm.rb +165 -0
  98. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmextensions_summary.rb +87 -0
  99. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_ids.rb +57 -0
  100. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_required_ids.rb +59 -0
  101. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vminstance_view.rb +202 -0
  102. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmlist_result.rb +77 -0
  103. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmprofile.rb +114 -0
  104. data/lib/azure_mgmt_compute/models/virtual_machine_scale_set_vmproperties.rb +190 -0
  105. data/lib/azure_mgmt_compute/models/virtual_machine_size.rb +1 -3
  106. data/lib/azure_mgmt_compute/models/virtual_machine_size_list_result.rb +4 -6
  107. data/lib/azure_mgmt_compute/models/virtual_machine_size_types.rb +53 -45
  108. data/lib/azure_mgmt_compute/models/virtual_machine_status_code_count.rb +68 -0
  109. data/lib/azure_mgmt_compute/models/win_rmconfiguration.rb +4 -6
  110. data/lib/azure_mgmt_compute/models/win_rmlistener.rb +3 -5
  111. data/lib/azure_mgmt_compute/models/windows_configuration.rb +4 -6
  112. data/lib/azure_mgmt_compute/module_definition.rb +5 -3
  113. data/lib/azure_mgmt_compute/usage_operations.rb +75 -42
  114. data/lib/azure_mgmt_compute/version.rb +5 -3
  115. data/lib/azure_mgmt_compute/virtual_machine_extension_images.rb +71 -158
  116. data/lib/azure_mgmt_compute/virtual_machine_extensions.rb +66 -149
  117. data/lib/azure_mgmt_compute/virtual_machine_images.rb +121 -264
  118. data/lib/azure_mgmt_compute/virtual_machine_scale_set_vms.rb +750 -0
  119. data/lib/azure_mgmt_compute/virtual_machine_scale_sets.rb +1327 -0
  120. data/lib/azure_mgmt_compute/virtual_machine_sizes.rb +75 -42
  121. data/lib/azure_mgmt_compute/virtual_machines.rb +397 -623
  122. data/lib/azure_mgmt_compute.rb +57 -18
  123. metadata +50 -128
  124. data/.gitignore +0 -10
  125. data/.travis.yml +0 -3
  126. data/Gemfile +0 -17
@@ -0,0 +1,750 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::Compute
7
+ #
8
+ # The Compute Management Client.
9
+ #
10
+ class VirtualMachineScaleSetVMs
11
+ include Azure::ARM::Compute::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the VirtualMachineScaleSetVMs class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the ComputeManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # The operation to re-image a virtual machine scale set instance.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
30
+ # @param instance_id [String] The instance id of the virtual machine.
31
+ # @return [Concurrent::Promise] promise which provides async access to http
32
+ # response.
33
+ #
34
+ def reimage(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
35
+ # Send request
36
+ promise = begin_reimage(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
37
+
38
+ promise = promise.then do |response|
39
+ # Defining deserialization method.
40
+ deserialize_method = lambda do |parsed_response|
41
+ end
42
+
43
+ # Waiting for response.
44
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
45
+ end
46
+
47
+ promise
48
+ end
49
+
50
+ #
51
+ # The operation to re-image a virtual machine scale set instance.
52
+ #
53
+ # @param resource_group_name [String] The name of the resource group.
54
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
55
+ # @param instance_id [String] The instance id of the virtual machine.
56
+ # @param [Hash{String => String}] The hash of custom headers need to be
57
+ # applied to HTTP request.
58
+ #
59
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
60
+ # response.
61
+ #
62
+ def begin_reimage(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
63
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
64
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
65
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
66
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
67
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
68
+ request_headers = {}
69
+
70
+ # Set Headers
71
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
72
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
73
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/reimage'
74
+ options = {
75
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
76
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
77
+ query_params: {'api-version' => @client.api_version},
78
+ headers: request_headers.merge(custom_headers || {})
79
+ }
80
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
81
+ promise = request.run_promise do |req|
82
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
83
+ end
84
+
85
+ promise = promise.then do |http_response|
86
+ status_code = http_response.status
87
+ response_content = http_response.body
88
+ unless status_code == 202
89
+ error_model = JSON.load(response_content)
90
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
91
+ end
92
+
93
+ # Create Result
94
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
95
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
96
+
97
+ result
98
+ end
99
+
100
+ promise.execute
101
+ end
102
+
103
+ #
104
+ # The operation to deallocate a virtual machine scale set.
105
+ #
106
+ # @param resource_group_name [String] The name of the resource group.
107
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
108
+ # @param instance_id [String] The instance id of the virtual machine.
109
+ # @return [Concurrent::Promise] promise which provides async access to http
110
+ # response.
111
+ #
112
+ def deallocate(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
113
+ # Send request
114
+ promise = begin_deallocate(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
115
+
116
+ promise = promise.then do |response|
117
+ # Defining deserialization method.
118
+ deserialize_method = lambda do |parsed_response|
119
+ end
120
+
121
+ # Waiting for response.
122
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
123
+ end
124
+
125
+ promise
126
+ end
127
+
128
+ #
129
+ # The operation to deallocate a virtual machine scale set.
130
+ #
131
+ # @param resource_group_name [String] The name of the resource group.
132
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
133
+ # @param instance_id [String] The instance id of the virtual machine.
134
+ # @param [Hash{String => String}] The hash of custom headers need to be
135
+ # applied to HTTP request.
136
+ #
137
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
138
+ # response.
139
+ #
140
+ def begin_deallocate(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
141
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
142
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
143
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
144
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
145
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
146
+ request_headers = {}
147
+
148
+ # Set Headers
149
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
150
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
151
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/deallocate'
152
+ options = {
153
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
154
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
155
+ query_params: {'api-version' => @client.api_version},
156
+ headers: request_headers.merge(custom_headers || {})
157
+ }
158
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
159
+ promise = request.run_promise do |req|
160
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
161
+ end
162
+
163
+ promise = promise.then do |http_response|
164
+ status_code = http_response.status
165
+ response_content = http_response.body
166
+ unless status_code == 202
167
+ error_model = JSON.load(response_content)
168
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
169
+ end
170
+
171
+ # Create Result
172
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
173
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
174
+
175
+ result
176
+ end
177
+
178
+ promise.execute
179
+ end
180
+
181
+ #
182
+ # The operation to delete a virtual machine scale set.
183
+ #
184
+ # @param resource_group_name [String] The name of the resource group.
185
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
186
+ # @param instance_id [String] The instance id of the virtual machine.
187
+ # @return [Concurrent::Promise] promise which provides async access to http
188
+ # response.
189
+ #
190
+ def delete(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
191
+ # Send request
192
+ promise = begin_delete(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
193
+
194
+ promise = promise.then do |response|
195
+ # Defining deserialization method.
196
+ deserialize_method = lambda do |parsed_response|
197
+ end
198
+
199
+ # Waiting for response.
200
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
201
+ end
202
+
203
+ promise
204
+ end
205
+
206
+ #
207
+ # The operation to delete a virtual machine scale set.
208
+ #
209
+ # @param resource_group_name [String] The name of the resource group.
210
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
211
+ # @param instance_id [String] The instance id of the virtual machine.
212
+ # @param [Hash{String => String}] The hash of custom headers need to be
213
+ # applied to HTTP request.
214
+ #
215
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
216
+ # response.
217
+ #
218
+ def begin_delete(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
219
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
220
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
221
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
222
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
223
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
224
+ request_headers = {}
225
+
226
+ # Set Headers
227
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
228
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
229
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'
230
+ options = {
231
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
232
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
233
+ query_params: {'api-version' => @client.api_version},
234
+ headers: request_headers.merge(custom_headers || {})
235
+ }
236
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :delete, options)
237
+ promise = request.run_promise do |req|
238
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
239
+ end
240
+
241
+ promise = promise.then do |http_response|
242
+ status_code = http_response.status
243
+ response_content = http_response.body
244
+ unless status_code == 200 || status_code == 202 || status_code == 204
245
+ error_model = JSON.load(response_content)
246
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
247
+ end
248
+
249
+ # Create Result
250
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
251
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
252
+
253
+ result
254
+ end
255
+
256
+ promise.execute
257
+ end
258
+
259
+ #
260
+ # The operation to get a virtual machine scale set virtual machine.
261
+ #
262
+ # @param resource_group_name [String] The name of the resource group.
263
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
264
+ # @param instance_id [String] The instance id of the virtual machine.
265
+ # @param [Hash{String => String}] The hash of custom headers need to be
266
+ # applied to HTTP request.
267
+ #
268
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
269
+ # response.
270
+ #
271
+ def get(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
272
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
273
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
274
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
275
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
276
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
277
+ request_headers = {}
278
+
279
+ # Set Headers
280
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
281
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
282
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}'
283
+ options = {
284
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
285
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
286
+ query_params: {'api-version' => @client.api_version},
287
+ headers: request_headers.merge(custom_headers || {})
288
+ }
289
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
290
+ promise = request.run_promise do |req|
291
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
292
+ end
293
+
294
+ promise = promise.then do |http_response|
295
+ status_code = http_response.status
296
+ response_content = http_response.body
297
+ unless status_code == 200
298
+ error_model = JSON.load(response_content)
299
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
300
+ end
301
+
302
+ # Create Result
303
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
304
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
305
+ # Deserialize Response
306
+ if status_code == 200
307
+ begin
308
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
309
+ unless parsed_response.nil?
310
+ parsed_response = VirtualMachineScaleSetVM.deserialize_object(parsed_response)
311
+ end
312
+ result.body = parsed_response
313
+ rescue Exception => e
314
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
315
+ end
316
+ end
317
+
318
+ result
319
+ end
320
+
321
+ promise.execute
322
+ end
323
+
324
+ #
325
+ # The operation to get a virtual machine scale set virtual machine.
326
+ #
327
+ # @param resource_group_name [String] The name of the resource group.
328
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
329
+ # @param instance_id [String] The instance id of the virtual machine.
330
+ # @param [Hash{String => String}] The hash of custom headers need to be
331
+ # applied to HTTP request.
332
+ #
333
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
334
+ # response.
335
+ #
336
+ def get_instance_view(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
337
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
338
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
339
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
340
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
341
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
342
+ request_headers = {}
343
+
344
+ # Set Headers
345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
347
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/instanceView'
348
+ options = {
349
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
350
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
351
+ query_params: {'api-version' => @client.api_version},
352
+ headers: request_headers.merge(custom_headers || {})
353
+ }
354
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
355
+ promise = request.run_promise do |req|
356
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
357
+ end
358
+
359
+ promise = promise.then do |http_response|
360
+ status_code = http_response.status
361
+ response_content = http_response.body
362
+ unless status_code == 200
363
+ error_model = JSON.load(response_content)
364
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
365
+ end
366
+
367
+ # Create Result
368
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
369
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
370
+ # Deserialize Response
371
+ if status_code == 200
372
+ begin
373
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
374
+ unless parsed_response.nil?
375
+ parsed_response = VirtualMachineScaleSetVMInstanceView.deserialize_object(parsed_response)
376
+ end
377
+ result.body = parsed_response
378
+ rescue Exception => e
379
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
380
+ end
381
+ end
382
+
383
+ result
384
+ end
385
+
386
+ promise.execute
387
+ end
388
+
389
+ #
390
+ # The operation to list virtual machine scale sets VMs.
391
+ #
392
+ # @param resource_group_name [String] The name of the resource group.
393
+ # @param virtual_machine_scale_set_name [String] The name of the virtual
394
+ # machine scale set.
395
+ # @param filter [String] The filter to apply on the operation.
396
+ # @param select [String] The list parameters.
397
+ # @param expand [String] The expand expression to apply on the operation.
398
+ # @param [Hash{String => String}] The hash of custom headers need to be
399
+ # applied to HTTP request.
400
+ #
401
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
402
+ # response.
403
+ #
404
+ def list(resource_group_name, virtual_machine_scale_set_name, filter = nil, select = nil, expand = nil, custom_headers = nil)
405
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
406
+ fail ArgumentError, 'virtual_machine_scale_set_name is nil' if virtual_machine_scale_set_name.nil?
407
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
408
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
409
+ request_headers = {}
410
+
411
+ # Set Headers
412
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
413
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
414
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{virtualMachineScaleSetName}/virtualMachines'
415
+ options = {
416
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
417
+ path_params: {'resourceGroupName' => resource_group_name,'virtualMachineScaleSetName' => virtual_machine_scale_set_name,'subscriptionId' => @client.subscription_id},
418
+ query_params: {'$filter' => filter,'$select' => select,'$expand' => expand,'api-version' => @client.api_version},
419
+ headers: request_headers.merge(custom_headers || {})
420
+ }
421
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
422
+ promise = request.run_promise do |req|
423
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
424
+ end
425
+
426
+ promise = promise.then do |http_response|
427
+ status_code = http_response.status
428
+ response_content = http_response.body
429
+ unless status_code == 200
430
+ error_model = JSON.load(response_content)
431
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
432
+ end
433
+
434
+ # Create Result
435
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
436
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
437
+ # Deserialize Response
438
+ if status_code == 200
439
+ begin
440
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
441
+ unless parsed_response.nil?
442
+ parsed_response = VirtualMachineScaleSetVMListResult.deserialize_object(parsed_response)
443
+ end
444
+ result.body = parsed_response
445
+ rescue Exception => e
446
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
447
+ end
448
+ end
449
+
450
+ result
451
+ end
452
+
453
+ promise.execute
454
+ end
455
+
456
+ #
457
+ # The operation to power off (stop) a virtual machine scale set.
458
+ #
459
+ # @param resource_group_name [String] The name of the resource group.
460
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
461
+ # @param instance_id [String] The instance id of the virtual machine.
462
+ # @return [Concurrent::Promise] promise which provides async access to http
463
+ # response.
464
+ #
465
+ def power_off(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
466
+ # Send request
467
+ promise = begin_power_off(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
468
+
469
+ promise = promise.then do |response|
470
+ # Defining deserialization method.
471
+ deserialize_method = lambda do |parsed_response|
472
+ end
473
+
474
+ # Waiting for response.
475
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
476
+ end
477
+
478
+ promise
479
+ end
480
+
481
+ #
482
+ # The operation to power off (stop) a virtual machine scale set.
483
+ #
484
+ # @param resource_group_name [String] The name of the resource group.
485
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
486
+ # @param instance_id [String] The instance id of the virtual machine.
487
+ # @param [Hash{String => String}] The hash of custom headers need to be
488
+ # applied to HTTP request.
489
+ #
490
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
491
+ # response.
492
+ #
493
+ def begin_power_off(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
494
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
495
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
496
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
497
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
498
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
499
+ request_headers = {}
500
+
501
+ # Set Headers
502
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
503
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
504
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/poweroff'
505
+ options = {
506
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
507
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
508
+ query_params: {'api-version' => @client.api_version},
509
+ headers: request_headers.merge(custom_headers || {})
510
+ }
511
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
512
+ promise = request.run_promise do |req|
513
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
514
+ end
515
+
516
+ promise = promise.then do |http_response|
517
+ status_code = http_response.status
518
+ response_content = http_response.body
519
+ unless status_code == 202
520
+ error_model = JSON.load(response_content)
521
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
522
+ end
523
+
524
+ # Create Result
525
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
526
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
527
+
528
+ result
529
+ end
530
+
531
+ promise.execute
532
+ end
533
+
534
+ #
535
+ # The operation to restart a virtual machine scale set.
536
+ #
537
+ # @param resource_group_name [String] The name of the resource group.
538
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
539
+ # @param instance_id [String] The instance id of the virtual machine.
540
+ # @return [Concurrent::Promise] promise which provides async access to http
541
+ # response.
542
+ #
543
+ def restart(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
544
+ # Send request
545
+ promise = begin_restart(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
546
+
547
+ promise = promise.then do |response|
548
+ # Defining deserialization method.
549
+ deserialize_method = lambda do |parsed_response|
550
+ end
551
+
552
+ # Waiting for response.
553
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
554
+ end
555
+
556
+ promise
557
+ end
558
+
559
+ #
560
+ # The operation to restart a virtual machine scale set.
561
+ #
562
+ # @param resource_group_name [String] The name of the resource group.
563
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
564
+ # @param instance_id [String] The instance id of the virtual machine.
565
+ # @param [Hash{String => String}] The hash of custom headers need to be
566
+ # applied to HTTP request.
567
+ #
568
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
569
+ # response.
570
+ #
571
+ def begin_restart(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
572
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
573
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
574
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
575
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
576
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
577
+ request_headers = {}
578
+
579
+ # Set Headers
580
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
581
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
582
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/restart'
583
+ options = {
584
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
585
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
586
+ query_params: {'api-version' => @client.api_version},
587
+ headers: request_headers.merge(custom_headers || {})
588
+ }
589
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
590
+ promise = request.run_promise do |req|
591
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
592
+ end
593
+
594
+ promise = promise.then do |http_response|
595
+ status_code = http_response.status
596
+ response_content = http_response.body
597
+ unless status_code == 202
598
+ error_model = JSON.load(response_content)
599
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
600
+ end
601
+
602
+ # Create Result
603
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
604
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
605
+
606
+ result
607
+ end
608
+
609
+ promise.execute
610
+ end
611
+
612
+ #
613
+ # The operation to start a virtual machine scale set.
614
+ #
615
+ # @param resource_group_name [String] The name of the resource group.
616
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
617
+ # @param instance_id [String] The instance id of the virtual machine.
618
+ # @return [Concurrent::Promise] promise which provides async access to http
619
+ # response.
620
+ #
621
+ def start(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
622
+ # Send request
623
+ promise = begin_start(resource_group_name, vm_scale_set_name, instance_id, custom_headers)
624
+
625
+ promise = promise.then do |response|
626
+ # Defining deserialization method.
627
+ deserialize_method = lambda do |parsed_response|
628
+ end
629
+
630
+ # Waiting for response.
631
+ @client.get_post_or_delete_operation_result(response, deserialize_method)
632
+ end
633
+
634
+ promise
635
+ end
636
+
637
+ #
638
+ # The operation to start a virtual machine scale set.
639
+ #
640
+ # @param resource_group_name [String] The name of the resource group.
641
+ # @param vm_scale_set_name [String] The name of the virtual machine scale set.
642
+ # @param instance_id [String] The instance id of the virtual machine.
643
+ # @param [Hash{String => String}] The hash of custom headers need to be
644
+ # applied to HTTP request.
645
+ #
646
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
647
+ # response.
648
+ #
649
+ def begin_start(resource_group_name, vm_scale_set_name, instance_id, custom_headers = nil)
650
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
651
+ fail ArgumentError, 'vm_scale_set_name is nil' if vm_scale_set_name.nil?
652
+ fail ArgumentError, 'instance_id is nil' if instance_id.nil?
653
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
654
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
655
+ request_headers = {}
656
+
657
+ # Set Headers
658
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
659
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
660
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}/virtualmachines/{instanceId}/start'
661
+ options = {
662
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
663
+ path_params: {'resourceGroupName' => resource_group_name,'vmScaleSetName' => vm_scale_set_name,'instanceId' => instance_id,'subscriptionId' => @client.subscription_id},
664
+ query_params: {'api-version' => @client.api_version},
665
+ headers: request_headers.merge(custom_headers || {})
666
+ }
667
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :post, options)
668
+ promise = request.run_promise do |req|
669
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
670
+ end
671
+
672
+ promise = promise.then do |http_response|
673
+ status_code = http_response.status
674
+ response_content = http_response.body
675
+ unless status_code == 202
676
+ error_model = JSON.load(response_content)
677
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
678
+ end
679
+
680
+ # Create Result
681
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
682
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
683
+
684
+ result
685
+ end
686
+
687
+ promise.execute
688
+ end
689
+
690
+ #
691
+ # The operation to list virtual machine scale sets VMs.
692
+ #
693
+ # @param next_page_link [String] The NextLink from the previous successful
694
+ # call to List operation.
695
+ # @param [Hash{String => String}] The hash of custom headers need to be
696
+ # applied to HTTP request.
697
+ #
698
+ # @return [Concurrent::Promise] Promise object which allows to get HTTP
699
+ # response.
700
+ #
701
+ def list_next(next_page_link, custom_headers = nil)
702
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
703
+ request_headers = {}
704
+
705
+ # Set Headers
706
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
707
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
708
+ path_template = '{nextLink}'
709
+ options = {
710
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
711
+ skip_encoding_path_params: {'nextLink' => next_page_link},
712
+ headers: request_headers.merge(custom_headers || {})
713
+ }
714
+ request = MsRest::HttpOperationRequest.new(@base_url || @client.base_url, path_template, :get, options)
715
+ promise = request.run_promise do |req|
716
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
717
+ end
718
+
719
+ promise = promise.then do |http_response|
720
+ status_code = http_response.status
721
+ response_content = http_response.body
722
+ unless status_code == 200
723
+ error_model = JSON.load(response_content)
724
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
725
+ end
726
+
727
+ # Create Result
728
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
729
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
730
+ # Deserialize Response
731
+ if status_code == 200
732
+ begin
733
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
734
+ unless parsed_response.nil?
735
+ parsed_response = VirtualMachineScaleSetVMListResult.deserialize_object(parsed_response)
736
+ end
737
+ result.body = parsed_response
738
+ rescue Exception => e
739
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
740
+ end
741
+ end
742
+
743
+ result
744
+ end
745
+
746
+ promise.execute
747
+ end
748
+
749
+ end
750
+ end