azure_mgmt_labservices 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-10-15/generated/azure_mgmt_labservices.rb +109 -0
  4. data/lib/2018-10-15/generated/azure_mgmt_labservices/environment_settings.rb +1254 -0
  5. data/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb +1286 -0
  6. data/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb +672 -0
  7. data/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb +1131 -0
  8. data/lib/2018-10-15/generated/azure_mgmt_labservices/lab_accounts.rb +1093 -0
  9. data/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb +890 -0
  10. data/lib/2018-10-15/generated/azure_mgmt_labservices/managed_labs_client.rb +163 -0
  11. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/add_remove.rb +16 -0
  12. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/add_users_payload.rb +55 -0
  13. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/configuration_state.rb +16 -0
  14. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/create_lab_properties.rb +101 -0
  15. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment.rb +235 -0
  16. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_details.rb +149 -0
  17. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_fragment.rb +121 -0
  18. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_operations_payload.rb +47 -0
  19. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting.rb +210 -0
  20. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting_creation_parameters.rb +48 -0
  21. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting_fragment.rb +157 -0
  22. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_size.rb +110 -0
  23. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_size_fragment.rb +69 -0
  24. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image.rb +231 -0
  25. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_fragment.rb +143 -0
  26. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_reference.rb +90 -0
  27. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_reference_fragment.rb +90 -0
  28. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_environment_response.rb +48 -0
  29. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_personal_preferences_response.rb +65 -0
  30. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_regional_availability_response.rb +56 -0
  31. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab.rb +219 -0
  32. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_account.rb +147 -0
  33. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_account_fragment.rb +119 -0
  34. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_creation_parameters.rb +46 -0
  35. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_details.rb +82 -0
  36. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_fragment.rb +144 -0
  37. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_user_access_mode.rb +16 -0
  38. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/latest_operation_result.rb +107 -0
  39. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_environments_payload.rb +46 -0
  40. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_environments_response.rb +55 -0
  41. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_labs_response.rb +55 -0
  42. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/managed_lab_vm_size.rb +17 -0
  43. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/network_interface.rb +83 -0
  44. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_payload.rb +54 -0
  45. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_response.rb +57 -0
  46. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_response_item.rb +61 -0
  47. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_error.rb +57 -0
  48. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_metadata.rb +59 -0
  49. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_metadata_display.rb +80 -0
  50. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_result.rb +59 -0
  51. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_status_payload.rb +46 -0
  52. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_status_response.rb +48 -0
  53. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/personal_preferences_operations_payload.rb +71 -0
  54. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/provider_operation_result.rb +101 -0
  55. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/publish_payload.rb +47 -0
  56. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/publishing_state.rb +19 -0
  57. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm.rb +84 -0
  58. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm_creation_parameters.rb +57 -0
  59. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm_fragment.rb +58 -0
  60. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/regional_availability.rb +67 -0
  61. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/register_payload.rb +46 -0
  62. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reset_password_payload.rb +68 -0
  63. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource.rb +110 -0
  64. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_set.rb +57 -0
  65. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_set_fragment.rb +57 -0
  66. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_setting_creation_parameters.rb +94 -0
  67. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_settings.rb +108 -0
  68. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_settings_fragment.rb +71 -0
  69. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_environment.rb +98 -0
  70. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_environment_setting.rb +100 -0
  71. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_gallery_image.rb +98 -0
  72. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_lab.rb +98 -0
  73. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_lab_account.rb +98 -0
  74. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_user.rb +98 -0
  75. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_availability.rb +59 -0
  76. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_configuration_properties.rb +56 -0
  77. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_configuration_properties_fragment.rb +56 -0
  78. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_info.rb +82 -0
  79. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_info_fragment.rb +82 -0
  80. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/user.rb +186 -0
  81. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/user_fragment.rb +108 -0
  82. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/virtual_machine_details.rb +107 -0
  83. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/vm_state_details.rb +86 -0
  84. data/lib/2018-10-15/generated/azure_mgmt_labservices/module_definition.rb +9 -0
  85. data/lib/2018-10-15/generated/azure_mgmt_labservices/operations.rb +117 -0
  86. data/lib/2018-10-15/generated/azure_mgmt_labservices/provider_operations.rb +215 -0
  87. data/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb +729 -0
  88. data/lib/azure_mgmt_labservices.rb +6 -0
  89. data/lib/module_definition.rb +7 -0
  90. data/lib/profiles/latest/labservices_latest_profile_client.rb +40 -0
  91. data/lib/profiles/latest/labservices_module_definition.rb +8 -0
  92. data/lib/profiles/latest/modules/labservices_profile_module.rb +369 -0
  93. data/lib/version.rb +7 -0
  94. metadata +210 -0
@@ -0,0 +1,1131 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Labservices::Mgmt::V2018_10_15
7
+ #
8
+ # The Managed Labs Client.
9
+ #
10
+ class GlobalUsers
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the GlobalUsers class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [ManagedLabsClient] reference to the ManagedLabsClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Gets the virtual machine details
26
+ #
27
+ # @param user_name [String] The name of the user.
28
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
29
+ # Represents payload for any Environment operations like get, start, stop,
30
+ # connect
31
+ # @param expand [String] Specify the $expand query. Example:
32
+ # 'properties($expand=environment)'
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [GetEnvironmentResponse] operation results.
37
+ #
38
+ def get_environment(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
39
+ response = get_environment_async(user_name, environment_operations_payload, expand:expand, custom_headers:custom_headers).value!
40
+ response.body unless response.nil?
41
+ end
42
+
43
+ #
44
+ # Gets the virtual machine details
45
+ #
46
+ # @param user_name [String] The name of the user.
47
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
48
+ # Represents payload for any Environment operations like get, start, stop,
49
+ # connect
50
+ # @param expand [String] Specify the $expand query. Example:
51
+ # 'properties($expand=environment)'
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def get_environment_with_http_info(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
58
+ get_environment_async(user_name, environment_operations_payload, expand:expand, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Gets the virtual machine details
63
+ #
64
+ # @param user_name [String] The name of the user.
65
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
66
+ # Represents payload for any Environment operations like get, start, stop,
67
+ # connect
68
+ # @param expand [String] Specify the $expand query. Example:
69
+ # 'properties($expand=environment)'
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def get_environment_async(user_name, environment_operations_payload, expand:nil, custom_headers:nil)
76
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
77
+ fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.nil?
78
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
+
88
+ # Serialize Request
89
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
90
+ request_content = @client.serialize(request_mapper, environment_operations_payload)
91
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
92
+
93
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/getEnvironment'
94
+
95
+ request_url = @base_url || @client.base_url
96
+
97
+ options = {
98
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
99
+ path_params: {'userName' => user_name},
100
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
101
+ body: request_content,
102
+ headers: request_headers.merge(custom_headers || {}),
103
+ base_url: request_url
104
+ }
105
+ promise = @client.make_request_async(:post, path_template, options)
106
+
107
+ promise = promise.then do |result|
108
+ http_response = result.response
109
+ status_code = http_response.status
110
+ response_content = http_response.body
111
+ unless status_code == 200
112
+ error_model = JSON.load(response_content)
113
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
114
+ end
115
+
116
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
117
+ # Deserialize Response
118
+ if status_code == 200
119
+ begin
120
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
121
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GetEnvironmentResponse.mapper()
122
+ result.body = @client.deserialize(result_mapper, parsed_response)
123
+ rescue Exception => e
124
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
125
+ end
126
+ end
127
+
128
+ result
129
+ end
130
+
131
+ promise.execute
132
+ end
133
+
134
+ #
135
+ # Get batch operation status
136
+ #
137
+ # @param user_name [String] The name of the user.
138
+ # @param operation_batch_status_payload [OperationBatchStatusPayload] Payload
139
+ # to get the status of an operation
140
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
141
+ # will be added to the HTTP request.
142
+ #
143
+ # @return [OperationBatchStatusResponse] operation results.
144
+ #
145
+ def get_operation_batch_status(user_name, operation_batch_status_payload, custom_headers:nil)
146
+ response = get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
147
+ response.body unless response.nil?
148
+ end
149
+
150
+ #
151
+ # Get batch operation status
152
+ #
153
+ # @param user_name [String] The name of the user.
154
+ # @param operation_batch_status_payload [OperationBatchStatusPayload] Payload
155
+ # to get the status of an operation
156
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
157
+ # will be added to the HTTP request.
158
+ #
159
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
160
+ #
161
+ def get_operation_batch_status_with_http_info(user_name, operation_batch_status_payload, custom_headers:nil)
162
+ get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:custom_headers).value!
163
+ end
164
+
165
+ #
166
+ # Get batch operation status
167
+ #
168
+ # @param user_name [String] The name of the user.
169
+ # @param operation_batch_status_payload [OperationBatchStatusPayload] Payload
170
+ # to get the status of an operation
171
+ # @param [Hash{String => String}] A hash of custom headers that will be added
172
+ # to the HTTP request.
173
+ #
174
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
175
+ #
176
+ def get_operation_batch_status_async(user_name, operation_batch_status_payload, custom_headers:nil)
177
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
178
+ fail ArgumentError, 'operation_batch_status_payload is nil' if operation_batch_status_payload.nil?
179
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
180
+
181
+
182
+ request_headers = {}
183
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
184
+
185
+ # Set Headers
186
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
187
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
188
+
189
+ # Serialize Request
190
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationBatchStatusPayload.mapper()
191
+ request_content = @client.serialize(request_mapper, operation_batch_status_payload)
192
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
193
+
194
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/getOperationBatchStatus'
195
+
196
+ request_url = @base_url || @client.base_url
197
+
198
+ options = {
199
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
200
+ path_params: {'userName' => user_name},
201
+ query_params: {'api-version' => @client.api_version},
202
+ body: request_content,
203
+ headers: request_headers.merge(custom_headers || {}),
204
+ base_url: request_url
205
+ }
206
+ promise = @client.make_request_async(:post, path_template, options)
207
+
208
+ promise = promise.then do |result|
209
+ http_response = result.response
210
+ status_code = http_response.status
211
+ response_content = http_response.body
212
+ unless status_code == 200
213
+ error_model = JSON.load(response_content)
214
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
215
+ end
216
+
217
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
218
+ # Deserialize Response
219
+ if status_code == 200
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationBatchStatusResponse.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response)
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Gets the status of long running operation
237
+ #
238
+ # @param user_name [String] The name of the user.
239
+ # @param operation_status_payload [OperationStatusPayload] Payload to get the
240
+ # status of an operation
241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
242
+ # will be added to the HTTP request.
243
+ #
244
+ # @return [OperationStatusResponse] operation results.
245
+ #
246
+ def get_operation_status(user_name, operation_status_payload, custom_headers:nil)
247
+ response = get_operation_status_async(user_name, operation_status_payload, custom_headers:custom_headers).value!
248
+ response.body unless response.nil?
249
+ end
250
+
251
+ #
252
+ # Gets the status of long running operation
253
+ #
254
+ # @param user_name [String] The name of the user.
255
+ # @param operation_status_payload [OperationStatusPayload] Payload to get the
256
+ # status of an operation
257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
258
+ # will be added to the HTTP request.
259
+ #
260
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
261
+ #
262
+ def get_operation_status_with_http_info(user_name, operation_status_payload, custom_headers:nil)
263
+ get_operation_status_async(user_name, operation_status_payload, custom_headers:custom_headers).value!
264
+ end
265
+
266
+ #
267
+ # Gets the status of long running operation
268
+ #
269
+ # @param user_name [String] The name of the user.
270
+ # @param operation_status_payload [OperationStatusPayload] Payload to get the
271
+ # status of an operation
272
+ # @param [Hash{String => String}] A hash of custom headers that will be added
273
+ # to the HTTP request.
274
+ #
275
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
276
+ #
277
+ def get_operation_status_async(user_name, operation_status_payload, custom_headers:nil)
278
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
279
+ fail ArgumentError, 'operation_status_payload is nil' if operation_status_payload.nil?
280
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
281
+
282
+
283
+ request_headers = {}
284
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
285
+
286
+ # Set Headers
287
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
288
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
289
+
290
+ # Serialize Request
291
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationStatusPayload.mapper()
292
+ request_content = @client.serialize(request_mapper, operation_status_payload)
293
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
294
+
295
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/getOperationStatus'
296
+
297
+ request_url = @base_url || @client.base_url
298
+
299
+ options = {
300
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
301
+ path_params: {'userName' => user_name},
302
+ query_params: {'api-version' => @client.api_version},
303
+ body: request_content,
304
+ headers: request_headers.merge(custom_headers || {}),
305
+ base_url: request_url
306
+ }
307
+ promise = @client.make_request_async(:post, path_template, options)
308
+
309
+ promise = promise.then do |result|
310
+ http_response = result.response
311
+ status_code = http_response.status
312
+ response_content = http_response.body
313
+ unless status_code == 200
314
+ error_model = JSON.load(response_content)
315
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
316
+ end
317
+
318
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
319
+ # Deserialize Response
320
+ if status_code == 200
321
+ begin
322
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
323
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::OperationStatusResponse.mapper()
324
+ result.body = @client.deserialize(result_mapper, parsed_response)
325
+ rescue Exception => e
326
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
327
+ end
328
+ end
329
+
330
+ result
331
+ end
332
+
333
+ promise.execute
334
+ end
335
+
336
+ #
337
+ # Get personal preferences for a user
338
+ #
339
+ # @param user_name [String] The name of the user.
340
+ # @param personal_preferences_operations_payload
341
+ # [PersonalPreferencesOperationsPayload] Represents payload for any Environment
342
+ # operations like get, start, stop, connect
343
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
344
+ # will be added to the HTTP request.
345
+ #
346
+ # @return [GetPersonalPreferencesResponse] operation results.
347
+ #
348
+ def get_personal_preferences(user_name, personal_preferences_operations_payload, custom_headers:nil)
349
+ response = get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:custom_headers).value!
350
+ response.body unless response.nil?
351
+ end
352
+
353
+ #
354
+ # Get personal preferences for a user
355
+ #
356
+ # @param user_name [String] The name of the user.
357
+ # @param personal_preferences_operations_payload
358
+ # [PersonalPreferencesOperationsPayload] Represents payload for any Environment
359
+ # operations like get, start, stop, connect
360
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
361
+ # will be added to the HTTP request.
362
+ #
363
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
364
+ #
365
+ def get_personal_preferences_with_http_info(user_name, personal_preferences_operations_payload, custom_headers:nil)
366
+ get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:custom_headers).value!
367
+ end
368
+
369
+ #
370
+ # Get personal preferences for a user
371
+ #
372
+ # @param user_name [String] The name of the user.
373
+ # @param personal_preferences_operations_payload
374
+ # [PersonalPreferencesOperationsPayload] Represents payload for any Environment
375
+ # operations like get, start, stop, connect
376
+ # @param [Hash{String => String}] A hash of custom headers that will be added
377
+ # to the HTTP request.
378
+ #
379
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
380
+ #
381
+ def get_personal_preferences_async(user_name, personal_preferences_operations_payload, custom_headers:nil)
382
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
383
+ fail ArgumentError, 'personal_preferences_operations_payload is nil' if personal_preferences_operations_payload.nil?
384
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
385
+
386
+
387
+ request_headers = {}
388
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
389
+
390
+ # Set Headers
391
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
392
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
393
+
394
+ # Serialize Request
395
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::PersonalPreferencesOperationsPayload.mapper()
396
+ request_content = @client.serialize(request_mapper, personal_preferences_operations_payload)
397
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
398
+
399
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/getPersonalPreferences'
400
+
401
+ request_url = @base_url || @client.base_url
402
+
403
+ options = {
404
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
405
+ path_params: {'userName' => user_name},
406
+ query_params: {'api-version' => @client.api_version},
407
+ body: request_content,
408
+ headers: request_headers.merge(custom_headers || {}),
409
+ base_url: request_url
410
+ }
411
+ promise = @client.make_request_async(:post, path_template, options)
412
+
413
+ promise = promise.then do |result|
414
+ http_response = result.response
415
+ status_code = http_response.status
416
+ response_content = http_response.body
417
+ unless status_code == 200
418
+ error_model = JSON.load(response_content)
419
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
420
+ end
421
+
422
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
423
+ # Deserialize Response
424
+ if status_code == 200
425
+ begin
426
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
427
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GetPersonalPreferencesResponse.mapper()
428
+ result.body = @client.deserialize(result_mapper, parsed_response)
429
+ rescue Exception => e
430
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
431
+ end
432
+ end
433
+
434
+ result
435
+ end
436
+
437
+ promise.execute
438
+ end
439
+
440
+ #
441
+ # List Environments for the user
442
+ #
443
+ # @param user_name [String] The name of the user.
444
+ # @param list_environments_payload [ListEnvironmentsPayload] Represents the
445
+ # payload to list environments owned by a user
446
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
447
+ # will be added to the HTTP request.
448
+ #
449
+ # @return [ListEnvironmentsResponse] operation results.
450
+ #
451
+ def list_environments(user_name, list_environments_payload, custom_headers:nil)
452
+ response = list_environments_async(user_name, list_environments_payload, custom_headers:custom_headers).value!
453
+ response.body unless response.nil?
454
+ end
455
+
456
+ #
457
+ # List Environments for the user
458
+ #
459
+ # @param user_name [String] The name of the user.
460
+ # @param list_environments_payload [ListEnvironmentsPayload] Represents the
461
+ # payload to list environments owned by a user
462
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
463
+ # will be added to the HTTP request.
464
+ #
465
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
466
+ #
467
+ def list_environments_with_http_info(user_name, list_environments_payload, custom_headers:nil)
468
+ list_environments_async(user_name, list_environments_payload, custom_headers:custom_headers).value!
469
+ end
470
+
471
+ #
472
+ # List Environments for the user
473
+ #
474
+ # @param user_name [String] The name of the user.
475
+ # @param list_environments_payload [ListEnvironmentsPayload] Represents the
476
+ # payload to list environments owned by a user
477
+ # @param [Hash{String => String}] A hash of custom headers that will be added
478
+ # to the HTTP request.
479
+ #
480
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
481
+ #
482
+ def list_environments_async(user_name, list_environments_payload, custom_headers:nil)
483
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
484
+ fail ArgumentError, 'list_environments_payload is nil' if list_environments_payload.nil?
485
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
486
+
487
+
488
+ request_headers = {}
489
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
490
+
491
+ # Set Headers
492
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
493
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
494
+
495
+ # Serialize Request
496
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListEnvironmentsPayload.mapper()
497
+ request_content = @client.serialize(request_mapper, list_environments_payload)
498
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
499
+
500
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/listEnvironments'
501
+
502
+ request_url = @base_url || @client.base_url
503
+
504
+ options = {
505
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
506
+ path_params: {'userName' => user_name},
507
+ query_params: {'api-version' => @client.api_version},
508
+ body: request_content,
509
+ headers: request_headers.merge(custom_headers || {}),
510
+ base_url: request_url
511
+ }
512
+ promise = @client.make_request_async(:post, path_template, options)
513
+
514
+ promise = promise.then do |result|
515
+ http_response = result.response
516
+ status_code = http_response.status
517
+ response_content = http_response.body
518
+ unless status_code == 200
519
+ error_model = JSON.load(response_content)
520
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
521
+ end
522
+
523
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
524
+ # Deserialize Response
525
+ if status_code == 200
526
+ begin
527
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
528
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListEnvironmentsResponse.mapper()
529
+ result.body = @client.deserialize(result_mapper, parsed_response)
530
+ rescue Exception => e
531
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
532
+ end
533
+ end
534
+
535
+ result
536
+ end
537
+
538
+ promise.execute
539
+ end
540
+
541
+ #
542
+ # List labs for the user.
543
+ #
544
+ # @param user_name [String] The name of the user.
545
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
546
+ # will be added to the HTTP request.
547
+ #
548
+ # @return [ListLabsResponse] operation results.
549
+ #
550
+ def list_labs(user_name, custom_headers:nil)
551
+ response = list_labs_async(user_name, custom_headers:custom_headers).value!
552
+ response.body unless response.nil?
553
+ end
554
+
555
+ #
556
+ # List labs for the user.
557
+ #
558
+ # @param user_name [String] The name of the user.
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
563
+ #
564
+ def list_labs_with_http_info(user_name, custom_headers:nil)
565
+ list_labs_async(user_name, custom_headers:custom_headers).value!
566
+ end
567
+
568
+ #
569
+ # List labs for the user.
570
+ #
571
+ # @param user_name [String] The name of the user.
572
+ # @param [Hash{String => String}] A hash of custom headers that will be added
573
+ # to the HTTP request.
574
+ #
575
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
576
+ #
577
+ def list_labs_async(user_name, custom_headers:nil)
578
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
579
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
580
+
581
+
582
+ request_headers = {}
583
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
584
+
585
+ # Set Headers
586
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
587
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
588
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/listLabs'
589
+
590
+ request_url = @base_url || @client.base_url
591
+
592
+ options = {
593
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
594
+ path_params: {'userName' => user_name},
595
+ query_params: {'api-version' => @client.api_version},
596
+ headers: request_headers.merge(custom_headers || {}),
597
+ base_url: request_url
598
+ }
599
+ promise = @client.make_request_async(:post, path_template, options)
600
+
601
+ promise = promise.then do |result|
602
+ http_response = result.response
603
+ status_code = http_response.status
604
+ response_content = http_response.body
605
+ unless status_code == 200
606
+ error_model = JSON.load(response_content)
607
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
608
+ end
609
+
610
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
611
+ # Deserialize Response
612
+ if status_code == 200
613
+ begin
614
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
615
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ListLabsResponse.mapper()
616
+ result.body = @client.deserialize(result_mapper, parsed_response)
617
+ rescue Exception => e
618
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
619
+ end
620
+ end
621
+
622
+ result
623
+ end
624
+
625
+ promise.execute
626
+ end
627
+
628
+ #
629
+ # Register a user to a managed lab
630
+ #
631
+ # @param user_name [String] The name of the user.
632
+ # @param register_payload [RegisterPayload] Represents payload for Register
633
+ # action.
634
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
635
+ # will be added to the HTTP request.
636
+ #
637
+ #
638
+ def register(user_name, register_payload, custom_headers:nil)
639
+ response = register_async(user_name, register_payload, custom_headers:custom_headers).value!
640
+ nil
641
+ end
642
+
643
+ #
644
+ # Register a user to a managed lab
645
+ #
646
+ # @param user_name [String] The name of the user.
647
+ # @param register_payload [RegisterPayload] Represents payload for Register
648
+ # action.
649
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
650
+ # will be added to the HTTP request.
651
+ #
652
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
653
+ #
654
+ def register_with_http_info(user_name, register_payload, custom_headers:nil)
655
+ register_async(user_name, register_payload, custom_headers:custom_headers).value!
656
+ end
657
+
658
+ #
659
+ # Register a user to a managed lab
660
+ #
661
+ # @param user_name [String] The name of the user.
662
+ # @param register_payload [RegisterPayload] Represents payload for Register
663
+ # action.
664
+ # @param [Hash{String => String}] A hash of custom headers that will be added
665
+ # to the HTTP request.
666
+ #
667
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
668
+ #
669
+ def register_async(user_name, register_payload, custom_headers:nil)
670
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
671
+ fail ArgumentError, 'register_payload is nil' if register_payload.nil?
672
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
673
+
674
+
675
+ request_headers = {}
676
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
677
+
678
+ # Set Headers
679
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
680
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
681
+
682
+ # Serialize Request
683
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::RegisterPayload.mapper()
684
+ request_content = @client.serialize(request_mapper, register_payload)
685
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
686
+
687
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/register'
688
+
689
+ request_url = @base_url || @client.base_url
690
+
691
+ options = {
692
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
693
+ path_params: {'userName' => user_name},
694
+ query_params: {'api-version' => @client.api_version},
695
+ body: request_content,
696
+ headers: request_headers.merge(custom_headers || {}),
697
+ base_url: request_url
698
+ }
699
+ promise = @client.make_request_async(:post, path_template, options)
700
+
701
+ promise = promise.then do |result|
702
+ http_response = result.response
703
+ status_code = http_response.status
704
+ response_content = http_response.body
705
+ unless status_code == 200
706
+ error_model = JSON.load(response_content)
707
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
708
+ end
709
+
710
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
711
+
712
+ result
713
+ end
714
+
715
+ promise.execute
716
+ end
717
+
718
+ #
719
+ # Resets the user password on an environment This operation can take a while to
720
+ # complete
721
+ #
722
+ # @param user_name [String] The name of the user.
723
+ # @param reset_password_payload [ResetPasswordPayload] Represents the payload
724
+ # for resetting passwords.
725
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
726
+ # will be added to the HTTP request.
727
+ #
728
+ def reset_password(user_name, reset_password_payload, custom_headers:nil)
729
+ response = reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
730
+ nil
731
+ end
732
+
733
+ #
734
+ # @param user_name [String] The name of the user.
735
+ # @param reset_password_payload [ResetPasswordPayload] Represents the payload
736
+ # for resetting passwords.
737
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
738
+ # will be added to the HTTP request.
739
+ #
740
+ # @return [Concurrent::Promise] promise which provides async access to http
741
+ # response.
742
+ #
743
+ def reset_password_async(user_name, reset_password_payload, custom_headers:nil)
744
+ # Send request
745
+ promise = begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers)
746
+
747
+ promise = promise.then do |response|
748
+ # Defining deserialization method.
749
+ deserialize_method = lambda do |parsed_response|
750
+ end
751
+
752
+ # Waiting for response.
753
+ @client.get_long_running_operation_result(response, deserialize_method)
754
+ end
755
+
756
+ promise
757
+ end
758
+
759
+ #
760
+ # Starts an environment by starting all resources inside the environment. This
761
+ # operation can take a while to complete
762
+ #
763
+ # @param user_name [String] The name of the user.
764
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
765
+ # Represents payload for any Environment operations like get, start, stop,
766
+ # connect
767
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
768
+ # will be added to the HTTP request.
769
+ #
770
+ def start_environment(user_name, environment_operations_payload, custom_headers:nil)
771
+ response = start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
772
+ nil
773
+ end
774
+
775
+ #
776
+ # @param user_name [String] The name of the user.
777
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
778
+ # Represents payload for any Environment operations like get, start, stop,
779
+ # connect
780
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
781
+ # will be added to the HTTP request.
782
+ #
783
+ # @return [Concurrent::Promise] promise which provides async access to http
784
+ # response.
785
+ #
786
+ def start_environment_async(user_name, environment_operations_payload, custom_headers:nil)
787
+ # Send request
788
+ promise = begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers)
789
+
790
+ promise = promise.then do |response|
791
+ # Defining deserialization method.
792
+ deserialize_method = lambda do |parsed_response|
793
+ end
794
+
795
+ # Waiting for response.
796
+ @client.get_long_running_operation_result(response, deserialize_method)
797
+ end
798
+
799
+ promise
800
+ end
801
+
802
+ #
803
+ # Stops an environment by stopping all resources inside the environment This
804
+ # operation can take a while to complete
805
+ #
806
+ # @param user_name [String] The name of the user.
807
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
808
+ # Represents payload for any Environment operations like get, start, stop,
809
+ # connect
810
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
811
+ # will be added to the HTTP request.
812
+ #
813
+ def stop_environment(user_name, environment_operations_payload, custom_headers:nil)
814
+ response = stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
815
+ nil
816
+ end
817
+
818
+ #
819
+ # @param user_name [String] The name of the user.
820
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
821
+ # Represents payload for any Environment operations like get, start, stop,
822
+ # connect
823
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
824
+ # will be added to the HTTP request.
825
+ #
826
+ # @return [Concurrent::Promise] promise which provides async access to http
827
+ # response.
828
+ #
829
+ def stop_environment_async(user_name, environment_operations_payload, custom_headers:nil)
830
+ # Send request
831
+ promise = begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers)
832
+
833
+ promise = promise.then do |response|
834
+ # Defining deserialization method.
835
+ deserialize_method = lambda do |parsed_response|
836
+ end
837
+
838
+ # Waiting for response.
839
+ @client.get_long_running_operation_result(response, deserialize_method)
840
+ end
841
+
842
+ promise
843
+ end
844
+
845
+ #
846
+ # Resets the user password on an environment This operation can take a while to
847
+ # complete
848
+ #
849
+ # @param user_name [String] The name of the user.
850
+ # @param reset_password_payload [ResetPasswordPayload] Represents the payload
851
+ # for resetting passwords.
852
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
853
+ # will be added to the HTTP request.
854
+ #
855
+ #
856
+ def begin_reset_password(user_name, reset_password_payload, custom_headers:nil)
857
+ response = begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
858
+ nil
859
+ end
860
+
861
+ #
862
+ # Resets the user password on an environment This operation can take a while to
863
+ # complete
864
+ #
865
+ # @param user_name [String] The name of the user.
866
+ # @param reset_password_payload [ResetPasswordPayload] Represents the payload
867
+ # for resetting passwords.
868
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
869
+ # will be added to the HTTP request.
870
+ #
871
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
872
+ #
873
+ def begin_reset_password_with_http_info(user_name, reset_password_payload, custom_headers:nil)
874
+ begin_reset_password_async(user_name, reset_password_payload, custom_headers:custom_headers).value!
875
+ end
876
+
877
+ #
878
+ # Resets the user password on an environment This operation can take a while to
879
+ # complete
880
+ #
881
+ # @param user_name [String] The name of the user.
882
+ # @param reset_password_payload [ResetPasswordPayload] Represents the payload
883
+ # for resetting passwords.
884
+ # @param [Hash{String => String}] A hash of custom headers that will be added
885
+ # to the HTTP request.
886
+ #
887
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
888
+ #
889
+ def begin_reset_password_async(user_name, reset_password_payload, custom_headers:nil)
890
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
891
+ fail ArgumentError, 'reset_password_payload is nil' if reset_password_payload.nil?
892
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
893
+
894
+
895
+ request_headers = {}
896
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
897
+
898
+ # Set Headers
899
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
900
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
901
+
902
+ # Serialize Request
903
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ResetPasswordPayload.mapper()
904
+ request_content = @client.serialize(request_mapper, reset_password_payload)
905
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
906
+
907
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/resetPassword'
908
+
909
+ request_url = @base_url || @client.base_url
910
+
911
+ options = {
912
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
913
+ path_params: {'userName' => user_name},
914
+ query_params: {'api-version' => @client.api_version},
915
+ body: request_content,
916
+ headers: request_headers.merge(custom_headers || {}),
917
+ base_url: request_url
918
+ }
919
+ promise = @client.make_request_async(:post, path_template, options)
920
+
921
+ promise = promise.then do |result|
922
+ http_response = result.response
923
+ status_code = http_response.status
924
+ response_content = http_response.body
925
+ unless status_code == 200 || status_code == 202
926
+ error_model = JSON.load(response_content)
927
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
928
+ end
929
+
930
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
931
+
932
+ result
933
+ end
934
+
935
+ promise.execute
936
+ end
937
+
938
+ #
939
+ # Starts an environment by starting all resources inside the environment. This
940
+ # operation can take a while to complete
941
+ #
942
+ # @param user_name [String] The name of the user.
943
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
944
+ # Represents payload for any Environment operations like get, start, stop,
945
+ # connect
946
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
947
+ # will be added to the HTTP request.
948
+ #
949
+ #
950
+ def begin_start_environment(user_name, environment_operations_payload, custom_headers:nil)
951
+ response = begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
952
+ nil
953
+ end
954
+
955
+ #
956
+ # Starts an environment by starting all resources inside the environment. This
957
+ # operation can take a while to complete
958
+ #
959
+ # @param user_name [String] The name of the user.
960
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
961
+ # Represents payload for any Environment operations like get, start, stop,
962
+ # connect
963
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
964
+ # will be added to the HTTP request.
965
+ #
966
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
967
+ #
968
+ def begin_start_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil)
969
+ begin_start_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
970
+ end
971
+
972
+ #
973
+ # Starts an environment by starting all resources inside the environment. This
974
+ # operation can take a while to complete
975
+ #
976
+ # @param user_name [String] The name of the user.
977
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
978
+ # Represents payload for any Environment operations like get, start, stop,
979
+ # connect
980
+ # @param [Hash{String => String}] A hash of custom headers that will be added
981
+ # to the HTTP request.
982
+ #
983
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
984
+ #
985
+ def begin_start_environment_async(user_name, environment_operations_payload, custom_headers:nil)
986
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
987
+ fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.nil?
988
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
989
+
990
+
991
+ request_headers = {}
992
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
993
+
994
+ # Set Headers
995
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
996
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
997
+
998
+ # Serialize Request
999
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
1000
+ request_content = @client.serialize(request_mapper, environment_operations_payload)
1001
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1002
+
1003
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/startEnvironment'
1004
+
1005
+ request_url = @base_url || @client.base_url
1006
+
1007
+ options = {
1008
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1009
+ path_params: {'userName' => user_name},
1010
+ query_params: {'api-version' => @client.api_version},
1011
+ body: request_content,
1012
+ headers: request_headers.merge(custom_headers || {}),
1013
+ base_url: request_url
1014
+ }
1015
+ promise = @client.make_request_async(:post, path_template, options)
1016
+
1017
+ promise = promise.then do |result|
1018
+ http_response = result.response
1019
+ status_code = http_response.status
1020
+ response_content = http_response.body
1021
+ unless status_code == 200 || status_code == 202
1022
+ error_model = JSON.load(response_content)
1023
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1024
+ end
1025
+
1026
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1027
+
1028
+ result
1029
+ end
1030
+
1031
+ promise.execute
1032
+ end
1033
+
1034
+ #
1035
+ # Stops an environment by stopping all resources inside the environment This
1036
+ # operation can take a while to complete
1037
+ #
1038
+ # @param user_name [String] The name of the user.
1039
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
1040
+ # Represents payload for any Environment operations like get, start, stop,
1041
+ # connect
1042
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1043
+ # will be added to the HTTP request.
1044
+ #
1045
+ #
1046
+ def begin_stop_environment(user_name, environment_operations_payload, custom_headers:nil)
1047
+ response = begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
1048
+ nil
1049
+ end
1050
+
1051
+ #
1052
+ # Stops an environment by stopping all resources inside the environment This
1053
+ # operation can take a while to complete
1054
+ #
1055
+ # @param user_name [String] The name of the user.
1056
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
1057
+ # Represents payload for any Environment operations like get, start, stop,
1058
+ # connect
1059
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1060
+ # will be added to the HTTP request.
1061
+ #
1062
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1063
+ #
1064
+ def begin_stop_environment_with_http_info(user_name, environment_operations_payload, custom_headers:nil)
1065
+ begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:custom_headers).value!
1066
+ end
1067
+
1068
+ #
1069
+ # Stops an environment by stopping all resources inside the environment This
1070
+ # operation can take a while to complete
1071
+ #
1072
+ # @param user_name [String] The name of the user.
1073
+ # @param environment_operations_payload [EnvironmentOperationsPayload]
1074
+ # Represents payload for any Environment operations like get, start, stop,
1075
+ # connect
1076
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1077
+ # to the HTTP request.
1078
+ #
1079
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1080
+ #
1081
+ def begin_stop_environment_async(user_name, environment_operations_payload, custom_headers:nil)
1082
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
1083
+ fail ArgumentError, 'environment_operations_payload is nil' if environment_operations_payload.nil?
1084
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1085
+
1086
+
1087
+ request_headers = {}
1088
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1089
+
1090
+ # Set Headers
1091
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1092
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1093
+
1094
+ # Serialize Request
1095
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::EnvironmentOperationsPayload.mapper()
1096
+ request_content = @client.serialize(request_mapper, environment_operations_payload)
1097
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1098
+
1099
+ path_template = 'providers/Microsoft.LabServices/users/{userName}/stopEnvironment'
1100
+
1101
+ request_url = @base_url || @client.base_url
1102
+
1103
+ options = {
1104
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1105
+ path_params: {'userName' => user_name},
1106
+ query_params: {'api-version' => @client.api_version},
1107
+ body: request_content,
1108
+ headers: request_headers.merge(custom_headers || {}),
1109
+ base_url: request_url
1110
+ }
1111
+ promise = @client.make_request_async(:post, path_template, options)
1112
+
1113
+ promise = promise.then do |result|
1114
+ http_response = result.response
1115
+ status_code = http_response.status
1116
+ response_content = http_response.body
1117
+ unless status_code == 200 || status_code == 202
1118
+ error_model = JSON.load(response_content)
1119
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1120
+ end
1121
+
1122
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1123
+
1124
+ result
1125
+ end
1126
+
1127
+ promise.execute
1128
+ end
1129
+
1130
+ end
1131
+ end