azure_mgmt_devtestlabs 0.4.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.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_devtestlabs.gemspec +34 -0
  6. data/lib/azure_mgmt_devtestlabs.rb +5 -0
  7. data/lib/generated/azure_mgmt_devtestlabs.rb +103 -0
  8. data/lib/generated/azure_mgmt_devtestlabs/artifact_operations.rb +477 -0
  9. data/lib/generated/azure_mgmt_devtestlabs/artifact_source_operations.rb +669 -0
  10. data/lib/generated/azure_mgmt_devtestlabs/cost_operations.rb +124 -0
  11. data/lib/generated/azure_mgmt_devtestlabs/custom_image_operations.rb +648 -0
  12. data/lib/generated/azure_mgmt_devtestlabs/dev_test_labs_client.rb +110 -0
  13. data/lib/generated/azure_mgmt_devtestlabs/formula_operations.rb +608 -0
  14. data/lib/generated/azure_mgmt_devtestlabs/gallery_image_operations.rb +252 -0
  15. data/lib/generated/azure_mgmt_devtestlabs/lab_operations.rb +1403 -0
  16. data/lib/generated/azure_mgmt_devtestlabs/models/apply_artifacts_request.rb +53 -0
  17. data/lib/generated/azure_mgmt_devtestlabs/models/arm_template_info.rb +54 -0
  18. data/lib/generated/azure_mgmt_devtestlabs/models/artifact.rb +151 -0
  19. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_deployment_status_properties.rb +66 -0
  20. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_install_properties.rb +63 -0
  21. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_parameter_properties.rb +54 -0
  22. data/lib/generated/azure_mgmt_devtestlabs/models/artifact_source.rb +183 -0
  23. data/lib/generated/azure_mgmt_devtestlabs/models/cost.rb +139 -0
  24. data/lib/generated/azure_mgmt_devtestlabs/models/cost_per_day_properties.rb +65 -0
  25. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image.rb +164 -0
  26. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_os_type.rb +17 -0
  27. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_custom.rb +65 -0
  28. data/lib/generated/azure_mgmt_devtestlabs/models/custom_image_properties_from_vm.rb +66 -0
  29. data/lib/generated/azure_mgmt_devtestlabs/models/day_details.rb +44 -0
  30. data/lib/generated/azure_mgmt_devtestlabs/models/enable_status.rb +16 -0
  31. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_properties.rb +64 -0
  32. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_request.rb +52 -0
  33. data/lib/generated/azure_mgmt_devtestlabs/models/evaluate_policies_response.rb +52 -0
  34. data/lib/generated/azure_mgmt_devtestlabs/models/formula.rb +174 -0
  35. data/lib/generated/azure_mgmt_devtestlabs/models/formula_properties_from_vm.rb +45 -0
  36. data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image.rb +153 -0
  37. data/lib/generated/azure_mgmt_devtestlabs/models/gallery_image_reference.rb +84 -0
  38. data/lib/generated/azure_mgmt_devtestlabs/models/generate_arm_template_request.rb +72 -0
  39. data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_parameter.rb +44 -0
  40. data/lib/generated/azure_mgmt_devtestlabs/models/generate_upload_uri_response.rb +44 -0
  41. data/lib/generated/azure_mgmt_devtestlabs/models/hour_details.rb +44 -0
  42. data/lib/generated/azure_mgmt_devtestlabs/models/lab.rb +162 -0
  43. data/lib/generated/azure_mgmt_devtestlabs/models/lab_cost_type.rb +17 -0
  44. data/lib/generated/azure_mgmt_devtestlabs/models/lab_storage_type.rb +16 -0
  45. data/lib/generated/azure_mgmt_devtestlabs/models/lab_vhd.rb +44 -0
  46. data/lib/generated/azure_mgmt_devtestlabs/models/lab_virtual_machine.rb +321 -0
  47. data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_info.rb +46 -0
  48. data/lib/generated/azure_mgmt_devtestlabs/models/linux_os_state.rb +17 -0
  49. data/lib/generated/azure_mgmt_devtestlabs/models/parameter_info.rb +54 -0
  50. data/lib/generated/azure_mgmt_devtestlabs/models/policy.rb +175 -0
  51. data/lib/generated/azure_mgmt_devtestlabs/models/policy_evaluator_type.rb +16 -0
  52. data/lib/generated/azure_mgmt_devtestlabs/models/policy_fact_name.rb +19 -0
  53. data/lib/generated/azure_mgmt_devtestlabs/models/policy_set_result.rb +63 -0
  54. data/lib/generated/azure_mgmt_devtestlabs/models/policy_status.rb +16 -0
  55. data/lib/generated/azure_mgmt_devtestlabs/models/policy_violation.rb +54 -0
  56. data/lib/generated/azure_mgmt_devtestlabs/models/resource_cost_properties.rb +106 -0
  57. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact.rb +93 -0
  58. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_artifact_source.rb +94 -0
  59. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_custom_image.rb +93 -0
  60. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_formula.rb +93 -0
  61. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_gallery_image.rb +93 -0
  62. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab.rb +93 -0
  63. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_vhd.rb +93 -0
  64. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_lab_virtual_machine.rb +95 -0
  65. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_policy.rb +93 -0
  66. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_schedule.rb +93 -0
  67. data/lib/generated/azure_mgmt_devtestlabs/models/response_with_continuation_virtual_network.rb +94 -0
  68. data/lib/generated/azure_mgmt_devtestlabs/models/schedule.rb +175 -0
  69. data/lib/generated/azure_mgmt_devtestlabs/models/source_control_type.rb +16 -0
  70. data/lib/generated/azure_mgmt_devtestlabs/models/subnet.rb +65 -0
  71. data/lib/generated/azure_mgmt_devtestlabs/models/subnet_override.rb +78 -0
  72. data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification.rb +67 -0
  73. data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification_properties.rb +44 -0
  74. data/lib/generated/azure_mgmt_devtestlabs/models/subscription_notification_state.rb +20 -0
  75. data/lib/generated/azure_mgmt_devtestlabs/models/usage_permission_type.rb +17 -0
  76. data/lib/generated/azure_mgmt_devtestlabs/models/virtual_network.rb +169 -0
  77. data/lib/generated/azure_mgmt_devtestlabs/models/week_details.rb +61 -0
  78. data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_info.rb +45 -0
  79. data/lib/generated/azure_mgmt_devtestlabs/models/windows_os_state.rb +17 -0
  80. data/lib/generated/azure_mgmt_devtestlabs/module_definition.rb +8 -0
  81. data/lib/generated/azure_mgmt_devtestlabs/policy_operations.rb +690 -0
  82. data/lib/generated/azure_mgmt_devtestlabs/policy_set.rb +137 -0
  83. data/lib/generated/azure_mgmt_devtestlabs/schedule_operations.rb +796 -0
  84. data/lib/generated/azure_mgmt_devtestlabs/version.rb +8 -0
  85. data/lib/generated/azure_mgmt_devtestlabs/virtual_machine.rb +1155 -0
  86. data/lib/generated/azure_mgmt_devtestlabs/virtual_network_operations.rb +759 -0
  87. metadata +199 -0
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DevTestLabs
7
+ VERSION = '0.4.0'
8
+ end
@@ -0,0 +1,1155 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::DevTestLabs
7
+ #
8
+ # The DevTest Labs Client.
9
+ #
10
+ class VirtualMachine
11
+ include Azure::ARM::DevTestLabs::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the VirtualMachine 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 DevTestLabsClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # List virtual machines in a given lab.
27
+ #
28
+ # @param resource_group_name [String] The name of the resource group.
29
+ # @param lab_name [String] The name of the lab.
30
+ # @param filter [String] The filter to apply on the operation.
31
+ # @param top [Integer] The maximum number of resources to return from the
32
+ # operation.
33
+ # @param order_by [String] The ordering expression for the results, using
34
+ # OData notation.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [ResponseWithContinuationLabVirtualMachine] which provide lazy
39
+ # access to pages of the response.
40
+ #
41
+ def list_as_lazy(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
42
+ response = list_async(resource_group_name, lab_name, filter, top, order_by, custom_headers).value!
43
+ unless response.nil?
44
+ page = response.body
45
+ page.next_method = Proc.new do |next_link|
46
+ list_next_async(next_link, custom_headers)
47
+ end
48
+ page
49
+ end
50
+ end
51
+
52
+ #
53
+ # List virtual machines in a given lab.
54
+ #
55
+ # @param resource_group_name [String] The name of the resource group.
56
+ # @param lab_name [String] The name of the lab.
57
+ # @param filter [String] The filter to apply on the operation.
58
+ # @param top [Integer] The maximum number of resources to return from the
59
+ # operation.
60
+ # @param order_by [String] The ordering expression for the results, using
61
+ # OData notation.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [Array<LabVirtualMachine>] operation results.
66
+ #
67
+ def list(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
68
+ first_page = list_as_lazy(resource_group_name, lab_name, filter, top, order_by, custom_headers)
69
+ first_page.get_all_items
70
+ end
71
+
72
+ #
73
+ # List virtual machines in a given lab.
74
+ #
75
+ # @param resource_group_name [String] The name of the resource group.
76
+ # @param lab_name [String] The name of the lab.
77
+ # @param filter [String] The filter to apply on the operation.
78
+ # @param top [Integer] The maximum number of resources to return from the
79
+ # operation.
80
+ # @param order_by [String] The ordering expression for the results, using
81
+ # OData notation.
82
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
83
+ # will be added to the HTTP request.
84
+ #
85
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
86
+ #
87
+ def list_with_http_info(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
88
+ list_async(resource_group_name, lab_name, filter, top, order_by, custom_headers).value!
89
+ end
90
+
91
+ #
92
+ # List virtual machines in a given lab.
93
+ #
94
+ # @param resource_group_name [String] The name of the resource group.
95
+ # @param lab_name [String] The name of the lab.
96
+ # @param filter [String] The filter to apply on the operation.
97
+ # @param top [Integer] The maximum number of resources to return from the
98
+ # operation.
99
+ # @param order_by [String] The ordering expression for the results, using
100
+ # OData notation.
101
+ # @param [Hash{String => String}] A hash of custom headers that will be added
102
+ # to the HTTP request.
103
+ #
104
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
105
+ #
106
+ def list_async(resource_group_name, lab_name, filter = nil, top = nil, order_by = nil, custom_headers = nil)
107
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
108
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
109
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
110
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
111
+
112
+
113
+ request_headers = {}
114
+
115
+ # Set Headers
116
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
117
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
118
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines'
119
+ options = {
120
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
121
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name},
122
+ query_params: {'$filter' => filter,'$top' => top,'$orderBy' => order_by,'api-version' => @client.api_version},
123
+ headers: request_headers.merge(custom_headers || {})
124
+ }
125
+
126
+ request_url = @base_url || @client.base_url
127
+
128
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
129
+ promise = request.run_promise do |req|
130
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
131
+ end
132
+
133
+ promise = promise.then do |http_response|
134
+ status_code = http_response.status
135
+ response_content = http_response.body
136
+ unless status_code == 200
137
+ error_model = JSON.load(response_content)
138
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
139
+ end
140
+
141
+ # Create Result
142
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
143
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
144
+ # Deserialize Response
145
+ if status_code == 200
146
+ begin
147
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
148
+ result_mapper = ResponseWithContinuationLabVirtualMachine.mapper()
149
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
150
+ rescue Exception => e
151
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
152
+ end
153
+ end
154
+
155
+ result
156
+ end
157
+
158
+ promise.execute
159
+ end
160
+
161
+ #
162
+ # Get virtual machine.
163
+ #
164
+ # @param resource_group_name [String] The name of the resource group.
165
+ # @param lab_name [String] The name of the lab.
166
+ # @param name [String] The name of the virtual Machine.
167
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
168
+ # will be added to the HTTP request.
169
+ #
170
+ # @return [LabVirtualMachine] operation results.
171
+ #
172
+ def get_resource(resource_group_name, lab_name, name, custom_headers = nil)
173
+ response = get_resource_async(resource_group_name, lab_name, name, custom_headers).value!
174
+ response.body unless response.nil?
175
+ end
176
+
177
+ #
178
+ # Get virtual machine.
179
+ #
180
+ # @param resource_group_name [String] The name of the resource group.
181
+ # @param lab_name [String] The name of the lab.
182
+ # @param name [String] The name of the virtual Machine.
183
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
184
+ # will be added to the HTTP request.
185
+ #
186
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
187
+ #
188
+ def get_resource_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
189
+ get_resource_async(resource_group_name, lab_name, name, custom_headers).value!
190
+ end
191
+
192
+ #
193
+ # Get virtual machine.
194
+ #
195
+ # @param resource_group_name [String] The name of the resource group.
196
+ # @param lab_name [String] The name of the lab.
197
+ # @param name [String] The name of the virtual Machine.
198
+ # @param [Hash{String => String}] A hash of custom headers that will be added
199
+ # to the HTTP request.
200
+ #
201
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
202
+ #
203
+ def get_resource_async(resource_group_name, lab_name, name, custom_headers = nil)
204
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
205
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
206
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
207
+ fail ArgumentError, 'name is nil' if name.nil?
208
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
209
+
210
+
211
+ request_headers = {}
212
+
213
+ # Set Headers
214
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
215
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
216
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
217
+ options = {
218
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
219
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
220
+ query_params: {'api-version' => @client.api_version},
221
+ headers: request_headers.merge(custom_headers || {})
222
+ }
223
+
224
+ request_url = @base_url || @client.base_url
225
+
226
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
227
+ promise = request.run_promise do |req|
228
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
229
+ end
230
+
231
+ promise = promise.then do |http_response|
232
+ status_code = http_response.status
233
+ response_content = http_response.body
234
+ unless status_code == 200
235
+ error_model = JSON.load(response_content)
236
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
237
+ end
238
+
239
+ # Create Result
240
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
241
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
242
+ # Deserialize Response
243
+ if status_code == 200
244
+ begin
245
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
246
+ result_mapper = LabVirtualMachine.mapper()
247
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
248
+ rescue Exception => e
249
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
250
+ end
251
+ end
252
+
253
+ result
254
+ end
255
+
256
+ promise.execute
257
+ end
258
+
259
+ #
260
+ # Create or replace an existing Virtual Machine. This operation can take a
261
+ # while to complete.
262
+ #
263
+ # @param resource_group_name [String] The name of the resource group.
264
+ # @param lab_name [String] The name of the lab.
265
+ # @param name [String] The name of the virtual Machine.
266
+ # @param lab_virtual_machine [LabVirtualMachine]
267
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
268
+ # will be added to the HTTP request.
269
+ #
270
+ # @return [LabVirtualMachine] operation results.
271
+ #
272
+ def create_or_update_resource(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
273
+ response = create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
274
+ response.body unless response.nil?
275
+ end
276
+
277
+ #
278
+ # @param resource_group_name [String] The name of the resource group.
279
+ # @param lab_name [String] The name of the lab.
280
+ # @param name [String] The name of the virtual Machine.
281
+ # @param lab_virtual_machine [LabVirtualMachine]
282
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
283
+ # will be added to the HTTP request.
284
+ #
285
+ # @return [Concurrent::Promise] promise which provides async access to http
286
+ # response.
287
+ #
288
+ def create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
289
+ # Send request
290
+ promise = begin_create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers)
291
+
292
+ promise = promise.then do |response|
293
+ # Defining deserialization method.
294
+ deserialize_method = lambda do |parsed_response|
295
+ result_mapper = LabVirtualMachine.mapper()
296
+ parsed_response = @client.deserialize(result_mapper, parsed_response, 'parsed_response')
297
+ end
298
+
299
+ # Waiting for response.
300
+ @client.get_long_running_operation_result(response, deserialize_method)
301
+ end
302
+
303
+ promise
304
+ end
305
+
306
+ #
307
+ # Create or replace an existing Virtual Machine. This operation can take a
308
+ # while to complete.
309
+ #
310
+ # @param resource_group_name [String] The name of the resource group.
311
+ # @param lab_name [String] The name of the lab.
312
+ # @param name [String] The name of the virtual Machine.
313
+ # @param lab_virtual_machine [LabVirtualMachine]
314
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
315
+ # will be added to the HTTP request.
316
+ #
317
+ # @return [LabVirtualMachine] operation results.
318
+ #
319
+ def begin_create_or_update_resource(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
320
+ response = begin_create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
321
+ response.body unless response.nil?
322
+ end
323
+
324
+ #
325
+ # Create or replace an existing Virtual Machine. This operation can take a
326
+ # while to complete.
327
+ #
328
+ # @param resource_group_name [String] The name of the resource group.
329
+ # @param lab_name [String] The name of the lab.
330
+ # @param name [String] The name of the virtual Machine.
331
+ # @param lab_virtual_machine [LabVirtualMachine]
332
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
333
+ # will be added to the HTTP request.
334
+ #
335
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
336
+ #
337
+ def begin_create_or_update_resource_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
338
+ begin_create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
339
+ end
340
+
341
+ #
342
+ # Create or replace an existing Virtual Machine. This operation can take a
343
+ # while to complete.
344
+ #
345
+ # @param resource_group_name [String] The name of the resource group.
346
+ # @param lab_name [String] The name of the lab.
347
+ # @param name [String] The name of the virtual Machine.
348
+ # @param lab_virtual_machine [LabVirtualMachine]
349
+ # @param [Hash{String => String}] A hash of custom headers that will be added
350
+ # to the HTTP request.
351
+ #
352
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
353
+ #
354
+ def begin_create_or_update_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
355
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
356
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
357
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
358
+ fail ArgumentError, 'name is nil' if name.nil?
359
+ fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
360
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
361
+
362
+
363
+ request_headers = {}
364
+
365
+ # Set Headers
366
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
367
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
368
+
369
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
370
+
371
+ # Serialize Request
372
+ request_mapper = LabVirtualMachine.mapper()
373
+ request_content = @client.serialize(request_mapper, lab_virtual_machine, 'lab_virtual_machine')
374
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
375
+
376
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
377
+ options = {
378
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
379
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
380
+ query_params: {'api-version' => @client.api_version},
381
+ body: request_content,
382
+ headers: request_headers.merge(custom_headers || {})
383
+ }
384
+
385
+ request_url = @base_url || @client.base_url
386
+
387
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
388
+ promise = request.run_promise do |req|
389
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
390
+ end
391
+
392
+ promise = promise.then do |http_response|
393
+ status_code = http_response.status
394
+ response_content = http_response.body
395
+ unless status_code == 200 || status_code == 201
396
+ error_model = JSON.load(response_content)
397
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
398
+ end
399
+
400
+ # Create Result
401
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
402
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
403
+ # Deserialize Response
404
+ if status_code == 200
405
+ begin
406
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
407
+ result_mapper = LabVirtualMachine.mapper()
408
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
409
+ rescue Exception => e
410
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
411
+ end
412
+ end
413
+ # Deserialize Response
414
+ if status_code == 201
415
+ begin
416
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
417
+ result_mapper = LabVirtualMachine.mapper()
418
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
419
+ rescue Exception => e
420
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
421
+ end
422
+ end
423
+
424
+ result
425
+ end
426
+
427
+ promise.execute
428
+ end
429
+
430
+ #
431
+ # Delete virtual machine. This operation can take a while to complete.
432
+ #
433
+ # @param resource_group_name [String] The name of the resource group.
434
+ # @param lab_name [String] The name of the lab.
435
+ # @param name [String] The name of the virtual Machine.
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ def delete_resource(resource_group_name, lab_name, name, custom_headers = nil)
440
+ response = delete_resource_async(resource_group_name, lab_name, name, custom_headers).value!
441
+ nil
442
+ end
443
+
444
+ #
445
+ # @param resource_group_name [String] The name of the resource group.
446
+ # @param lab_name [String] The name of the lab.
447
+ # @param name [String] The name of the virtual Machine.
448
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
449
+ # will be added to the HTTP request.
450
+ #
451
+ # @return [Concurrent::Promise] promise which provides async access to http
452
+ # response.
453
+ #
454
+ def delete_resource_async(resource_group_name, lab_name, name, custom_headers = nil)
455
+ # Send request
456
+ promise = begin_delete_resource_async(resource_group_name, lab_name, name, custom_headers)
457
+
458
+ promise = promise.then do |response|
459
+ # Defining deserialization method.
460
+ deserialize_method = lambda do |parsed_response|
461
+ end
462
+
463
+ # Waiting for response.
464
+ @client.get_long_running_operation_result(response, deserialize_method)
465
+ end
466
+
467
+ promise
468
+ end
469
+
470
+ #
471
+ # Delete virtual machine. This operation can take a while to complete.
472
+ #
473
+ # @param resource_group_name [String] The name of the resource group.
474
+ # @param lab_name [String] The name of the lab.
475
+ # @param name [String] The name of the virtual Machine.
476
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
477
+ # will be added to the HTTP request.
478
+ #
479
+ #
480
+ def begin_delete_resource(resource_group_name, lab_name, name, custom_headers = nil)
481
+ response = begin_delete_resource_async(resource_group_name, lab_name, name, custom_headers).value!
482
+ nil
483
+ end
484
+
485
+ #
486
+ # Delete virtual machine. This operation can take a while to complete.
487
+ #
488
+ # @param resource_group_name [String] The name of the resource group.
489
+ # @param lab_name [String] The name of the lab.
490
+ # @param name [String] The name of the virtual Machine.
491
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
492
+ # will be added to the HTTP request.
493
+ #
494
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
495
+ #
496
+ def begin_delete_resource_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
497
+ begin_delete_resource_async(resource_group_name, lab_name, name, custom_headers).value!
498
+ end
499
+
500
+ #
501
+ # Delete virtual machine. This operation can take a while to complete.
502
+ #
503
+ # @param resource_group_name [String] The name of the resource group.
504
+ # @param lab_name [String] The name of the lab.
505
+ # @param name [String] The name of the virtual Machine.
506
+ # @param [Hash{String => String}] A hash of custom headers that will be added
507
+ # to the HTTP request.
508
+ #
509
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
510
+ #
511
+ def begin_delete_resource_async(resource_group_name, lab_name, name, custom_headers = nil)
512
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
513
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
514
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
515
+ fail ArgumentError, 'name is nil' if name.nil?
516
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
517
+
518
+
519
+ request_headers = {}
520
+
521
+ # Set Headers
522
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
523
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
524
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
525
+ options = {
526
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
527
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
528
+ query_params: {'api-version' => @client.api_version},
529
+ headers: request_headers.merge(custom_headers || {})
530
+ }
531
+
532
+ request_url = @base_url || @client.base_url
533
+
534
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
535
+ promise = request.run_promise do |req|
536
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
537
+ end
538
+
539
+ promise = promise.then do |http_response|
540
+ status_code = http_response.status
541
+ response_content = http_response.body
542
+ unless status_code == 202 || status_code == 204
543
+ error_model = JSON.load(response_content)
544
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
545
+ end
546
+
547
+ # Create Result
548
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
549
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
550
+
551
+ result
552
+ end
553
+
554
+ promise.execute
555
+ end
556
+
557
+ #
558
+ # Modify properties of virtual machines.
559
+ #
560
+ # @param resource_group_name [String] The name of the resource group.
561
+ # @param lab_name [String] The name of the lab.
562
+ # @param name [String] The name of the virtual Machine.
563
+ # @param lab_virtual_machine [LabVirtualMachine]
564
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
565
+ # will be added to the HTTP request.
566
+ #
567
+ # @return [LabVirtualMachine] operation results.
568
+ #
569
+ def patch_resource(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
570
+ response = patch_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
571
+ response.body unless response.nil?
572
+ end
573
+
574
+ #
575
+ # Modify properties of virtual machines.
576
+ #
577
+ # @param resource_group_name [String] The name of the resource group.
578
+ # @param lab_name [String] The name of the lab.
579
+ # @param name [String] The name of the virtual Machine.
580
+ # @param lab_virtual_machine [LabVirtualMachine]
581
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
582
+ # will be added to the HTTP request.
583
+ #
584
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
585
+ #
586
+ def patch_resource_with_http_info(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
587
+ patch_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers).value!
588
+ end
589
+
590
+ #
591
+ # Modify properties of virtual machines.
592
+ #
593
+ # @param resource_group_name [String] The name of the resource group.
594
+ # @param lab_name [String] The name of the lab.
595
+ # @param name [String] The name of the virtual Machine.
596
+ # @param lab_virtual_machine [LabVirtualMachine]
597
+ # @param [Hash{String => String}] A hash of custom headers that will be added
598
+ # to the HTTP request.
599
+ #
600
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
601
+ #
602
+ def patch_resource_async(resource_group_name, lab_name, name, lab_virtual_machine, custom_headers = nil)
603
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
604
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
605
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
606
+ fail ArgumentError, 'name is nil' if name.nil?
607
+ fail ArgumentError, 'lab_virtual_machine is nil' if lab_virtual_machine.nil?
608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
609
+
610
+
611
+ request_headers = {}
612
+
613
+ # Set Headers
614
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
615
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
616
+
617
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
618
+
619
+ # Serialize Request
620
+ request_mapper = LabVirtualMachine.mapper()
621
+ request_content = @client.serialize(request_mapper, lab_virtual_machine, 'lab_virtual_machine')
622
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
623
+
624
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}'
625
+ options = {
626
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
627
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
628
+ query_params: {'api-version' => @client.api_version},
629
+ body: request_content,
630
+ headers: request_headers.merge(custom_headers || {})
631
+ }
632
+
633
+ request_url = @base_url || @client.base_url
634
+
635
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
636
+ promise = request.run_promise do |req|
637
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
638
+ end
639
+
640
+ promise = promise.then do |http_response|
641
+ status_code = http_response.status
642
+ response_content = http_response.body
643
+ unless status_code == 200
644
+ error_model = JSON.load(response_content)
645
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
646
+ end
647
+
648
+ # Create Result
649
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
650
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
651
+ # Deserialize Response
652
+ if status_code == 200
653
+ begin
654
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
655
+ result_mapper = LabVirtualMachine.mapper()
656
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
657
+ rescue Exception => e
658
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
659
+ end
660
+ end
661
+
662
+ result
663
+ end
664
+
665
+ promise.execute
666
+ end
667
+
668
+ #
669
+ # Apply artifacts to Lab VM. This operation can take a while to complete.
670
+ #
671
+ # @param resource_group_name [String] The name of the resource group.
672
+ # @param lab_name [String] The name of the lab.
673
+ # @param name [String] The name of the virtual Machine.
674
+ # @param apply_artifacts_request [ApplyArtifactsRequest]
675
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
676
+ # will be added to the HTTP request.
677
+ #
678
+ def apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
679
+ response = apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
680
+ nil
681
+ end
682
+
683
+ #
684
+ # @param resource_group_name [String] The name of the resource group.
685
+ # @param lab_name [String] The name of the lab.
686
+ # @param name [String] The name of the virtual Machine.
687
+ # @param apply_artifacts_request [ApplyArtifactsRequest]
688
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
689
+ # will be added to the HTTP request.
690
+ #
691
+ # @return [Concurrent::Promise] promise which provides async access to http
692
+ # response.
693
+ #
694
+ def apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
695
+ # Send request
696
+ promise = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers)
697
+
698
+ promise = promise.then do |response|
699
+ # Defining deserialization method.
700
+ deserialize_method = lambda do |parsed_response|
701
+ end
702
+
703
+ # Waiting for response.
704
+ @client.get_long_running_operation_result(response, deserialize_method)
705
+ end
706
+
707
+ promise
708
+ end
709
+
710
+ #
711
+ # Apply artifacts to Lab VM. This operation can take a while to complete.
712
+ #
713
+ # @param resource_group_name [String] The name of the resource group.
714
+ # @param lab_name [String] The name of the lab.
715
+ # @param name [String] The name of the virtual Machine.
716
+ # @param apply_artifacts_request [ApplyArtifactsRequest]
717
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
718
+ # will be added to the HTTP request.
719
+ #
720
+ #
721
+ def begin_apply_artifacts(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
722
+ response = begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
723
+ nil
724
+ end
725
+
726
+ #
727
+ # Apply artifacts to Lab VM. This operation can take a while to complete.
728
+ #
729
+ # @param resource_group_name [String] The name of the resource group.
730
+ # @param lab_name [String] The name of the lab.
731
+ # @param name [String] The name of the virtual Machine.
732
+ # @param apply_artifacts_request [ApplyArtifactsRequest]
733
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
734
+ # will be added to the HTTP request.
735
+ #
736
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
737
+ #
738
+ def begin_apply_artifacts_with_http_info(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
739
+ begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers).value!
740
+ end
741
+
742
+ #
743
+ # Apply artifacts to Lab VM. This operation can take a while to complete.
744
+ #
745
+ # @param resource_group_name [String] The name of the resource group.
746
+ # @param lab_name [String] The name of the lab.
747
+ # @param name [String] The name of the virtual Machine.
748
+ # @param apply_artifacts_request [ApplyArtifactsRequest]
749
+ # @param [Hash{String => String}] A hash of custom headers that will be added
750
+ # to the HTTP request.
751
+ #
752
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
753
+ #
754
+ def begin_apply_artifacts_async(resource_group_name, lab_name, name, apply_artifacts_request, custom_headers = nil)
755
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
756
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
757
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
758
+ fail ArgumentError, 'name is nil' if name.nil?
759
+ fail ArgumentError, 'apply_artifacts_request is nil' if apply_artifacts_request.nil?
760
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
761
+
762
+
763
+ request_headers = {}
764
+
765
+ # Set Headers
766
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
767
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
768
+
769
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
770
+
771
+ # Serialize Request
772
+ request_mapper = ApplyArtifactsRequest.mapper()
773
+ request_content = @client.serialize(request_mapper, apply_artifacts_request, 'apply_artifacts_request')
774
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
775
+
776
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/applyArtifacts'
777
+ options = {
778
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
779
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
780
+ query_params: {'api-version' => @client.api_version},
781
+ body: request_content,
782
+ headers: request_headers.merge(custom_headers || {})
783
+ }
784
+
785
+ request_url = @base_url || @client.base_url
786
+
787
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
788
+ promise = request.run_promise do |req|
789
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
790
+ end
791
+
792
+ promise = promise.then do |http_response|
793
+ status_code = http_response.status
794
+ response_content = http_response.body
795
+ unless status_code == 200 || status_code == 202
796
+ error_model = JSON.load(response_content)
797
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
798
+ end
799
+
800
+ # Create Result
801
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
802
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
803
+
804
+ result
805
+ end
806
+
807
+ promise.execute
808
+ end
809
+
810
+ #
811
+ # Start a Lab VM. This operation can take a while to complete.
812
+ #
813
+ # @param resource_group_name [String] The name of the resource group.
814
+ # @param lab_name [String] The name of the lab.
815
+ # @param name [String] The name of the virtual Machine.
816
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
817
+ # will be added to the HTTP request.
818
+ #
819
+ def start(resource_group_name, lab_name, name, custom_headers = nil)
820
+ response = start_async(resource_group_name, lab_name, name, custom_headers).value!
821
+ nil
822
+ end
823
+
824
+ #
825
+ # @param resource_group_name [String] The name of the resource group.
826
+ # @param lab_name [String] The name of the lab.
827
+ # @param name [String] The name of the virtual Machine.
828
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
829
+ # will be added to the HTTP request.
830
+ #
831
+ # @return [Concurrent::Promise] promise which provides async access to http
832
+ # response.
833
+ #
834
+ def start_async(resource_group_name, lab_name, name, custom_headers = nil)
835
+ # Send request
836
+ promise = begin_start_async(resource_group_name, lab_name, name, custom_headers)
837
+
838
+ promise = promise.then do |response|
839
+ # Defining deserialization method.
840
+ deserialize_method = lambda do |parsed_response|
841
+ end
842
+
843
+ # Waiting for response.
844
+ @client.get_long_running_operation_result(response, deserialize_method)
845
+ end
846
+
847
+ promise
848
+ end
849
+
850
+ #
851
+ # Start a Lab VM. This operation can take a while to complete.
852
+ #
853
+ # @param resource_group_name [String] The name of the resource group.
854
+ # @param lab_name [String] The name of the lab.
855
+ # @param name [String] The name of the virtual Machine.
856
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
857
+ # will be added to the HTTP request.
858
+ #
859
+ #
860
+ def begin_start(resource_group_name, lab_name, name, custom_headers = nil)
861
+ response = begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
862
+ nil
863
+ end
864
+
865
+ #
866
+ # Start a Lab VM. This operation can take a while to complete.
867
+ #
868
+ # @param resource_group_name [String] The name of the resource group.
869
+ # @param lab_name [String] The name of the lab.
870
+ # @param name [String] The name of the virtual Machine.
871
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
872
+ # will be added to the HTTP request.
873
+ #
874
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
875
+ #
876
+ def begin_start_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
877
+ begin_start_async(resource_group_name, lab_name, name, custom_headers).value!
878
+ end
879
+
880
+ #
881
+ # Start a Lab VM. This operation can take a while to complete.
882
+ #
883
+ # @param resource_group_name [String] The name of the resource group.
884
+ # @param lab_name [String] The name of the lab.
885
+ # @param name [String] The name of the virtual Machine.
886
+ # @param [Hash{String => String}] A hash of custom headers that will be added
887
+ # to the HTTP request.
888
+ #
889
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
890
+ #
891
+ def begin_start_async(resource_group_name, lab_name, name, custom_headers = nil)
892
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
893
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
894
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
895
+ fail ArgumentError, 'name is nil' if name.nil?
896
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
897
+
898
+
899
+ request_headers = {}
900
+
901
+ # Set Headers
902
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
903
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
904
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/start'
905
+ options = {
906
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
907
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
908
+ query_params: {'api-version' => @client.api_version},
909
+ headers: request_headers.merge(custom_headers || {})
910
+ }
911
+
912
+ request_url = @base_url || @client.base_url
913
+
914
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
915
+ promise = request.run_promise do |req|
916
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
917
+ end
918
+
919
+ promise = promise.then do |http_response|
920
+ status_code = http_response.status
921
+ response_content = http_response.body
922
+ unless status_code == 200 || status_code == 202
923
+ error_model = JSON.load(response_content)
924
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
925
+ end
926
+
927
+ # Create Result
928
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
929
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
930
+
931
+ result
932
+ end
933
+
934
+ promise.execute
935
+ end
936
+
937
+ #
938
+ # Stop a Lab VM. This operation can take a while to complete.
939
+ #
940
+ # @param resource_group_name [String] The name of the resource group.
941
+ # @param lab_name [String] The name of the lab.
942
+ # @param name [String] The name of the virtual Machine.
943
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
944
+ # will be added to the HTTP request.
945
+ #
946
+ def stop(resource_group_name, lab_name, name, custom_headers = nil)
947
+ response = stop_async(resource_group_name, lab_name, name, custom_headers).value!
948
+ nil
949
+ end
950
+
951
+ #
952
+ # @param resource_group_name [String] The name of the resource group.
953
+ # @param lab_name [String] The name of the lab.
954
+ # @param name [String] The name of the virtual Machine.
955
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
956
+ # will be added to the HTTP request.
957
+ #
958
+ # @return [Concurrent::Promise] promise which provides async access to http
959
+ # response.
960
+ #
961
+ def stop_async(resource_group_name, lab_name, name, custom_headers = nil)
962
+ # Send request
963
+ promise = begin_stop_async(resource_group_name, lab_name, name, custom_headers)
964
+
965
+ promise = promise.then do |response|
966
+ # Defining deserialization method.
967
+ deserialize_method = lambda do |parsed_response|
968
+ end
969
+
970
+ # Waiting for response.
971
+ @client.get_long_running_operation_result(response, deserialize_method)
972
+ end
973
+
974
+ promise
975
+ end
976
+
977
+ #
978
+ # Stop a Lab VM. This operation can take a while to complete.
979
+ #
980
+ # @param resource_group_name [String] The name of the resource group.
981
+ # @param lab_name [String] The name of the lab.
982
+ # @param name [String] The name of the virtual Machine.
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, lab_name, name, custom_headers = nil)
988
+ response = begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
989
+ nil
990
+ end
991
+
992
+ #
993
+ # Stop a Lab VM. This operation can take a while to complete.
994
+ #
995
+ # @param resource_group_name [String] The name of the resource group.
996
+ # @param lab_name [String] The name of the lab.
997
+ # @param name [String] The name of the virtual Machine.
998
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
999
+ # will be added to the HTTP request.
1000
+ #
1001
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1002
+ #
1003
+ def begin_stop_with_http_info(resource_group_name, lab_name, name, custom_headers = nil)
1004
+ begin_stop_async(resource_group_name, lab_name, name, custom_headers).value!
1005
+ end
1006
+
1007
+ #
1008
+ # Stop a Lab VM. This operation can take a while to complete.
1009
+ #
1010
+ # @param resource_group_name [String] The name of the resource group.
1011
+ # @param lab_name [String] The name of the lab.
1012
+ # @param name [String] The name of the virtual Machine.
1013
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1014
+ # to the HTTP request.
1015
+ #
1016
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1017
+ #
1018
+ def begin_stop_async(resource_group_name, lab_name, name, custom_headers = nil)
1019
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1020
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1021
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
1022
+ fail ArgumentError, 'name is nil' if name.nil?
1023
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1024
+
1025
+
1026
+ request_headers = {}
1027
+
1028
+ # Set Headers
1029
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1030
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1031
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/virtualmachines/{name}/stop'
1032
+ options = {
1033
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1034
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labName' => lab_name,'name' => name},
1035
+ query_params: {'api-version' => @client.api_version},
1036
+ headers: request_headers.merge(custom_headers || {})
1037
+ }
1038
+
1039
+ request_url = @base_url || @client.base_url
1040
+
1041
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
1042
+ promise = request.run_promise do |req|
1043
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1044
+ end
1045
+
1046
+ promise = promise.then do |http_response|
1047
+ status_code = http_response.status
1048
+ response_content = http_response.body
1049
+ unless status_code == 200 || status_code == 202
1050
+ error_model = JSON.load(response_content)
1051
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1052
+ end
1053
+
1054
+ # Create Result
1055
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1056
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1057
+
1058
+ result
1059
+ end
1060
+
1061
+ promise.execute
1062
+ end
1063
+
1064
+ #
1065
+ # List virtual machines in a given lab.
1066
+ #
1067
+ # @param next_page_link [String] The NextLink from the previous successful
1068
+ # call to List operation.
1069
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1070
+ # will be added to the HTTP request.
1071
+ #
1072
+ # @return [ResponseWithContinuationLabVirtualMachine] operation results.
1073
+ #
1074
+ def list_next(next_page_link, custom_headers = nil)
1075
+ response = list_next_async(next_page_link, custom_headers).value!
1076
+ response.body unless response.nil?
1077
+ end
1078
+
1079
+ #
1080
+ # List virtual machines in a given lab.
1081
+ #
1082
+ # @param next_page_link [String] The NextLink from the previous successful
1083
+ # call to List operation.
1084
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1085
+ # will be added to the HTTP request.
1086
+ #
1087
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1088
+ #
1089
+ def list_next_with_http_info(next_page_link, custom_headers = nil)
1090
+ list_next_async(next_page_link, custom_headers).value!
1091
+ end
1092
+
1093
+ #
1094
+ # List virtual machines in a given lab.
1095
+ #
1096
+ # @param next_page_link [String] The NextLink from the previous successful
1097
+ # call to List operation.
1098
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1099
+ # to the HTTP request.
1100
+ #
1101
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1102
+ #
1103
+ def list_next_async(next_page_link, custom_headers = nil)
1104
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1105
+
1106
+
1107
+ request_headers = {}
1108
+
1109
+ # Set Headers
1110
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1111
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1112
+ path_template = '{nextLink}'
1113
+ options = {
1114
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1115
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1116
+ headers: request_headers.merge(custom_headers || {})
1117
+ }
1118
+
1119
+ request_url = @base_url || @client.base_url
1120
+
1121
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
1122
+ promise = request.run_promise do |req|
1123
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
1124
+ end
1125
+
1126
+ promise = promise.then do |http_response|
1127
+ status_code = http_response.status
1128
+ response_content = http_response.body
1129
+ unless status_code == 200
1130
+ error_model = JSON.load(response_content)
1131
+ fail MsRestAzure::AzureOperationError.new(request, http_response, error_model)
1132
+ end
1133
+
1134
+ # Create Result
1135
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
1136
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1137
+ # Deserialize Response
1138
+ if status_code == 200
1139
+ begin
1140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1141
+ result_mapper = ResponseWithContinuationLabVirtualMachine.mapper()
1142
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
1143
+ rescue Exception => e
1144
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1145
+ end
1146
+ end
1147
+
1148
+ result
1149
+ end
1150
+
1151
+ promise.execute
1152
+ end
1153
+
1154
+ end
1155
+ end