azure_mgmt_labservices 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
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,729 @@
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 Users
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Users 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
+ # List users in a given lab.
26
+ #
27
+ # @param resource_group_name [String] The name of the resource group.
28
+ # @param lab_account_name [String] The name of the lab Account.
29
+ # @param lab_name [String] The name of the lab.
30
+ # @param expand [String] Specify the $expand query. Example:
31
+ # 'properties($select=email)'
32
+ # @param filter [String] The filter to apply to the operation.
33
+ # @param top [Integer] The maximum number of resources to return from the
34
+ # operation.
35
+ # @param orderby [String] The ordering expression for the results, using OData
36
+ # notation.
37
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
38
+ # will be added to the HTTP request.
39
+ #
40
+ # @return [Array<User>] operation results.
41
+ #
42
+ def list(resource_group_name, lab_account_name, lab_name, expand:nil, filter:nil, top:nil, orderby:nil, custom_headers:nil)
43
+ first_page = list_as_lazy(resource_group_name, lab_account_name, lab_name, expand:expand, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers)
44
+ first_page.get_all_items
45
+ end
46
+
47
+ #
48
+ # List users in a given lab.
49
+ #
50
+ # @param resource_group_name [String] The name of the resource group.
51
+ # @param lab_account_name [String] The name of the lab Account.
52
+ # @param lab_name [String] The name of the lab.
53
+ # @param expand [String] Specify the $expand query. Example:
54
+ # 'properties($select=email)'
55
+ # @param filter [String] The filter to apply to the operation.
56
+ # @param top [Integer] The maximum number of resources to return from the
57
+ # operation.
58
+ # @param orderby [String] The ordering expression for the results, using OData
59
+ # notation.
60
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
61
+ # will be added to the HTTP request.
62
+ #
63
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
64
+ #
65
+ def list_with_http_info(resource_group_name, lab_account_name, lab_name, expand:nil, filter:nil, top:nil, orderby:nil, custom_headers:nil)
66
+ list_async(resource_group_name, lab_account_name, lab_name, expand:expand, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers).value!
67
+ end
68
+
69
+ #
70
+ # List users in a given lab.
71
+ #
72
+ # @param resource_group_name [String] The name of the resource group.
73
+ # @param lab_account_name [String] The name of the lab Account.
74
+ # @param lab_name [String] The name of the lab.
75
+ # @param expand [String] Specify the $expand query. Example:
76
+ # 'properties($select=email)'
77
+ # @param filter [String] The filter to apply to the operation.
78
+ # @param top [Integer] The maximum number of resources to return from the
79
+ # operation.
80
+ # @param orderby [String] The ordering expression for the results, using OData
81
+ # notation.
82
+ # @param [Hash{String => String}] A hash of custom headers that will be added
83
+ # to the HTTP request.
84
+ #
85
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
86
+ #
87
+ def list_async(resource_group_name, lab_account_name, lab_name, expand:nil, filter:nil, top:nil, orderby:nil, custom_headers:nil)
88
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
89
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
90
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
91
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
92
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
93
+
94
+
95
+ request_headers = {}
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
+
98
+ # Set Headers
99
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
101
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users'
102
+
103
+ request_url = @base_url || @client.base_url
104
+
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'labName' => lab_name},
108
+ query_params: {'$expand' => expand,'$filter' => filter,'$top' => top,'$orderby' => orderby,'api-version' => @client.api_version},
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:get, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ # Deserialize Response
125
+ if status_code == 200
126
+ begin
127
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
128
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ResponseWithContinuationUser.mapper()
129
+ result.body = @client.deserialize(result_mapper, parsed_response)
130
+ rescue Exception => e
131
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
132
+ end
133
+ end
134
+
135
+ result
136
+ end
137
+
138
+ promise.execute
139
+ end
140
+
141
+ #
142
+ # Get user
143
+ #
144
+ # @param resource_group_name [String] The name of the resource group.
145
+ # @param lab_account_name [String] The name of the lab Account.
146
+ # @param lab_name [String] The name of the lab.
147
+ # @param user_name [String] The name of the user.
148
+ # @param expand [String] Specify the $expand query. Example:
149
+ # 'properties($select=email)'
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [User] operation results.
154
+ #
155
+ def get(resource_group_name, lab_account_name, lab_name, user_name, expand:nil, custom_headers:nil)
156
+ response = get_async(resource_group_name, lab_account_name, lab_name, user_name, expand:expand, custom_headers:custom_headers).value!
157
+ response.body unless response.nil?
158
+ end
159
+
160
+ #
161
+ # Get user
162
+ #
163
+ # @param resource_group_name [String] The name of the resource group.
164
+ # @param lab_account_name [String] The name of the lab Account.
165
+ # @param lab_name [String] The name of the lab.
166
+ # @param user_name [String] The name of the user.
167
+ # @param expand [String] Specify the $expand query. Example:
168
+ # 'properties($select=email)'
169
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
170
+ # will be added to the HTTP request.
171
+ #
172
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
173
+ #
174
+ def get_with_http_info(resource_group_name, lab_account_name, lab_name, user_name, expand:nil, custom_headers:nil)
175
+ get_async(resource_group_name, lab_account_name, lab_name, user_name, expand:expand, custom_headers:custom_headers).value!
176
+ end
177
+
178
+ #
179
+ # Get user
180
+ #
181
+ # @param resource_group_name [String] The name of the resource group.
182
+ # @param lab_account_name [String] The name of the lab Account.
183
+ # @param lab_name [String] The name of the lab.
184
+ # @param user_name [String] The name of the user.
185
+ # @param expand [String] Specify the $expand query. Example:
186
+ # 'properties($select=email)'
187
+ # @param [Hash{String => String}] A hash of custom headers that will be added
188
+ # to the HTTP request.
189
+ #
190
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
191
+ #
192
+ def get_async(resource_group_name, lab_account_name, lab_name, user_name, expand:nil, custom_headers:nil)
193
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
194
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
195
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
196
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
197
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
198
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
199
+
200
+
201
+ request_headers = {}
202
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
203
+
204
+ # Set Headers
205
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
206
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
207
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'
208
+
209
+ request_url = @base_url || @client.base_url
210
+
211
+ options = {
212
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
213
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'labName' => lab_name,'userName' => user_name},
214
+ query_params: {'$expand' => expand,'api-version' => @client.api_version},
215
+ headers: request_headers.merge(custom_headers || {}),
216
+ base_url: request_url
217
+ }
218
+ promise = @client.make_request_async(:get, path_template, options)
219
+
220
+ promise = promise.then do |result|
221
+ http_response = result.response
222
+ status_code = http_response.status
223
+ response_content = http_response.body
224
+ unless status_code == 200
225
+ error_model = JSON.load(response_content)
226
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
227
+ end
228
+
229
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
230
+ # Deserialize Response
231
+ if status_code == 200
232
+ begin
233
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
234
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::User.mapper()
235
+ result.body = @client.deserialize(result_mapper, parsed_response)
236
+ rescue Exception => e
237
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
238
+ end
239
+ end
240
+
241
+ result
242
+ end
243
+
244
+ promise.execute
245
+ end
246
+
247
+ #
248
+ # Create or replace an existing User.
249
+ #
250
+ # @param resource_group_name [String] The name of the resource group.
251
+ # @param lab_account_name [String] The name of the lab Account.
252
+ # @param lab_name [String] The name of the lab.
253
+ # @param user_name [String] The name of the user.
254
+ # @param user [User] The User registered to a lab
255
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
256
+ # will be added to the HTTP request.
257
+ #
258
+ # @return [User] operation results.
259
+ #
260
+ def create_or_update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
261
+ response = create_or_update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
262
+ response.body unless response.nil?
263
+ end
264
+
265
+ #
266
+ # Create or replace an existing User.
267
+ #
268
+ # @param resource_group_name [String] The name of the resource group.
269
+ # @param lab_account_name [String] The name of the lab Account.
270
+ # @param lab_name [String] The name of the lab.
271
+ # @param user_name [String] The name of the user.
272
+ # @param user [User] The User registered to a lab
273
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
274
+ # will be added to the HTTP request.
275
+ #
276
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
277
+ #
278
+ def create_or_update_with_http_info(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
279
+ create_or_update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
280
+ end
281
+
282
+ #
283
+ # Create or replace an existing User.
284
+ #
285
+ # @param resource_group_name [String] The name of the resource group.
286
+ # @param lab_account_name [String] The name of the lab Account.
287
+ # @param lab_name [String] The name of the lab.
288
+ # @param user_name [String] The name of the user.
289
+ # @param user [User] The User registered to a lab
290
+ # @param [Hash{String => String}] A hash of custom headers that will be added
291
+ # to the HTTP request.
292
+ #
293
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
294
+ #
295
+ def create_or_update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
296
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
297
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
298
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
299
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
300
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
301
+ fail ArgumentError, 'user is nil' if user.nil?
302
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
303
+
304
+
305
+ request_headers = {}
306
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
307
+
308
+ # Set Headers
309
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
310
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
311
+
312
+ # Serialize Request
313
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::User.mapper()
314
+ request_content = @client.serialize(request_mapper, user)
315
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
316
+
317
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'
318
+
319
+ request_url = @base_url || @client.base_url
320
+
321
+ options = {
322
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
323
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'labName' => lab_name,'userName' => user_name},
324
+ query_params: {'api-version' => @client.api_version},
325
+ body: request_content,
326
+ headers: request_headers.merge(custom_headers || {}),
327
+ base_url: request_url
328
+ }
329
+ promise = @client.make_request_async(:put, path_template, options)
330
+
331
+ promise = promise.then do |result|
332
+ http_response = result.response
333
+ status_code = http_response.status
334
+ response_content = http_response.body
335
+ unless status_code == 200 || status_code == 201
336
+ error_model = JSON.load(response_content)
337
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
338
+ end
339
+
340
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
341
+ # Deserialize Response
342
+ if status_code == 200
343
+ begin
344
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
345
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::User.mapper()
346
+ result.body = @client.deserialize(result_mapper, parsed_response)
347
+ rescue Exception => e
348
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
349
+ end
350
+ end
351
+ # Deserialize Response
352
+ if status_code == 201
353
+ begin
354
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
355
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::User.mapper()
356
+ result.body = @client.deserialize(result_mapper, parsed_response)
357
+ rescue Exception => e
358
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
359
+ end
360
+ end
361
+
362
+ result
363
+ end
364
+
365
+ promise.execute
366
+ end
367
+
368
+ #
369
+ # Delete user. This operation can take a while to complete
370
+ #
371
+ # @param resource_group_name [String] The name of the resource group.
372
+ # @param lab_account_name [String] The name of the lab Account.
373
+ # @param lab_name [String] The name of the lab.
374
+ # @param user_name [String] The name of the user.
375
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
376
+ # will be added to the HTTP request.
377
+ #
378
+ def delete(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:nil)
379
+ response = delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:custom_headers).value!
380
+ nil
381
+ end
382
+
383
+ #
384
+ # @param resource_group_name [String] The name of the resource group.
385
+ # @param lab_account_name [String] The name of the lab Account.
386
+ # @param lab_name [String] The name of the lab.
387
+ # @param user_name [String] The name of the user.
388
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
389
+ # will be added to the HTTP request.
390
+ #
391
+ # @return [Concurrent::Promise] promise which provides async access to http
392
+ # response.
393
+ #
394
+ def delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:nil)
395
+ # Send request
396
+ promise = begin_delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:custom_headers)
397
+
398
+ promise = promise.then do |response|
399
+ # Defining deserialization method.
400
+ deserialize_method = lambda do |parsed_response|
401
+ end
402
+
403
+ # Waiting for response.
404
+ @client.get_long_running_operation_result(response, deserialize_method)
405
+ end
406
+
407
+ promise
408
+ end
409
+
410
+ #
411
+ # Modify properties of users.
412
+ #
413
+ # @param resource_group_name [String] The name of the resource group.
414
+ # @param lab_account_name [String] The name of the lab Account.
415
+ # @param lab_name [String] The name of the lab.
416
+ # @param user_name [String] The name of the user.
417
+ # @param user [UserFragment] The User registered to a lab
418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
419
+ # will be added to the HTTP request.
420
+ #
421
+ # @return [User] operation results.
422
+ #
423
+ def update(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
424
+ response = update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
425
+ response.body unless response.nil?
426
+ end
427
+
428
+ #
429
+ # Modify properties of users.
430
+ #
431
+ # @param resource_group_name [String] The name of the resource group.
432
+ # @param lab_account_name [String] The name of the lab Account.
433
+ # @param lab_name [String] The name of the lab.
434
+ # @param user_name [String] The name of the user.
435
+ # @param user [UserFragment] The User registered to a lab
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
440
+ #
441
+ def update_with_http_info(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
442
+ update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:custom_headers).value!
443
+ end
444
+
445
+ #
446
+ # Modify properties of users.
447
+ #
448
+ # @param resource_group_name [String] The name of the resource group.
449
+ # @param lab_account_name [String] The name of the lab Account.
450
+ # @param lab_name [String] The name of the lab.
451
+ # @param user_name [String] The name of the user.
452
+ # @param user [UserFragment] The User registered to a lab
453
+ # @param [Hash{String => String}] A hash of custom headers that will be added
454
+ # to the HTTP request.
455
+ #
456
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
457
+ #
458
+ def update_async(resource_group_name, lab_account_name, lab_name, user_name, user, custom_headers:nil)
459
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
460
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
461
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
462
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
463
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
464
+ fail ArgumentError, 'user is nil' if user.nil?
465
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
466
+
467
+
468
+ request_headers = {}
469
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
470
+
471
+ # Set Headers
472
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
473
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
474
+
475
+ # Serialize Request
476
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::UserFragment.mapper()
477
+ request_content = @client.serialize(request_mapper, user)
478
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
479
+
480
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'
481
+
482
+ request_url = @base_url || @client.base_url
483
+
484
+ options = {
485
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
486
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'labName' => lab_name,'userName' => user_name},
487
+ query_params: {'api-version' => @client.api_version},
488
+ body: request_content,
489
+ headers: request_headers.merge(custom_headers || {}),
490
+ base_url: request_url
491
+ }
492
+ promise = @client.make_request_async(:patch, path_template, options)
493
+
494
+ promise = promise.then do |result|
495
+ http_response = result.response
496
+ status_code = http_response.status
497
+ response_content = http_response.body
498
+ unless status_code == 200
499
+ error_model = JSON.load(response_content)
500
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
501
+ end
502
+
503
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
504
+ # Deserialize Response
505
+ if status_code == 200
506
+ begin
507
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
508
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::User.mapper()
509
+ result.body = @client.deserialize(result_mapper, parsed_response)
510
+ rescue Exception => e
511
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
512
+ end
513
+ end
514
+
515
+ result
516
+ end
517
+
518
+ promise.execute
519
+ end
520
+
521
+ #
522
+ # Delete user. This operation can take a while to complete
523
+ #
524
+ # @param resource_group_name [String] The name of the resource group.
525
+ # @param lab_account_name [String] The name of the lab Account.
526
+ # @param lab_name [String] The name of the lab.
527
+ # @param user_name [String] The name of the user.
528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
529
+ # will be added to the HTTP request.
530
+ #
531
+ #
532
+ def begin_delete(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:nil)
533
+ response = begin_delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:custom_headers).value!
534
+ nil
535
+ end
536
+
537
+ #
538
+ # Delete user. This operation can take a while to complete
539
+ #
540
+ # @param resource_group_name [String] The name of the resource group.
541
+ # @param lab_account_name [String] The name of the lab Account.
542
+ # @param lab_name [String] The name of the lab.
543
+ # @param user_name [String] The name of the user.
544
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
545
+ # will be added to the HTTP request.
546
+ #
547
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
548
+ #
549
+ def begin_delete_with_http_info(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:nil)
550
+ begin_delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:custom_headers).value!
551
+ end
552
+
553
+ #
554
+ # Delete user. This operation can take a while to complete
555
+ #
556
+ # @param resource_group_name [String] The name of the resource group.
557
+ # @param lab_account_name [String] The name of the lab Account.
558
+ # @param lab_name [String] The name of the lab.
559
+ # @param user_name [String] The name of the user.
560
+ # @param [Hash{String => String}] A hash of custom headers that will be added
561
+ # to the HTTP request.
562
+ #
563
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
564
+ #
565
+ def begin_delete_async(resource_group_name, lab_account_name, lab_name, user_name, custom_headers:nil)
566
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
567
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
568
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
569
+ fail ArgumentError, 'lab_name is nil' if lab_name.nil?
570
+ fail ArgumentError, 'user_name is nil' if user_name.nil?
571
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
572
+
573
+
574
+ request_headers = {}
575
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
576
+
577
+ # Set Headers
578
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
579
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
580
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/labs/{labName}/users/{userName}'
581
+
582
+ request_url = @base_url || @client.base_url
583
+
584
+ options = {
585
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
586
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'labName' => lab_name,'userName' => user_name},
587
+ query_params: {'api-version' => @client.api_version},
588
+ headers: request_headers.merge(custom_headers || {}),
589
+ base_url: request_url
590
+ }
591
+ promise = @client.make_request_async(:delete, path_template, options)
592
+
593
+ promise = promise.then do |result|
594
+ http_response = result.response
595
+ status_code = http_response.status
596
+ response_content = http_response.body
597
+ unless status_code == 202 || status_code == 204
598
+ error_model = JSON.load(response_content)
599
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
600
+ end
601
+
602
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
603
+
604
+ result
605
+ end
606
+
607
+ promise.execute
608
+ end
609
+
610
+ #
611
+ # List users in a given lab.
612
+ #
613
+ # @param next_page_link [String] The NextLink from the previous successful call
614
+ # to List operation.
615
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
616
+ # will be added to the HTTP request.
617
+ #
618
+ # @return [ResponseWithContinuationUser] operation results.
619
+ #
620
+ def list_next(next_page_link, custom_headers:nil)
621
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
622
+ response.body unless response.nil?
623
+ end
624
+
625
+ #
626
+ # List users in a given lab.
627
+ #
628
+ # @param next_page_link [String] The NextLink from the previous successful call
629
+ # to List operation.
630
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
631
+ # will be added to the HTTP request.
632
+ #
633
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
634
+ #
635
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
636
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
637
+ end
638
+
639
+ #
640
+ # List users in a given lab.
641
+ #
642
+ # @param next_page_link [String] The NextLink from the previous successful call
643
+ # to List operation.
644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
645
+ # to the HTTP request.
646
+ #
647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
648
+ #
649
+ def list_next_async(next_page_link, custom_headers:nil)
650
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
651
+
652
+
653
+ request_headers = {}
654
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
655
+
656
+ # Set Headers
657
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
658
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
659
+ path_template = '{nextLink}'
660
+
661
+ request_url = @base_url || @client.base_url
662
+
663
+ options = {
664
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
665
+ skip_encoding_path_params: {'nextLink' => next_page_link},
666
+ headers: request_headers.merge(custom_headers || {}),
667
+ base_url: request_url
668
+ }
669
+ promise = @client.make_request_async(:get, path_template, options)
670
+
671
+ promise = promise.then do |result|
672
+ http_response = result.response
673
+ status_code = http_response.status
674
+ response_content = http_response.body
675
+ unless status_code == 200
676
+ error_model = JSON.load(response_content)
677
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
678
+ end
679
+
680
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
681
+ # Deserialize Response
682
+ if status_code == 200
683
+ begin
684
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
685
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ResponseWithContinuationUser.mapper()
686
+ result.body = @client.deserialize(result_mapper, parsed_response)
687
+ rescue Exception => e
688
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
689
+ end
690
+ end
691
+
692
+ result
693
+ end
694
+
695
+ promise.execute
696
+ end
697
+
698
+ #
699
+ # List users in a given lab.
700
+ #
701
+ # @param resource_group_name [String] The name of the resource group.
702
+ # @param lab_account_name [String] The name of the lab Account.
703
+ # @param lab_name [String] The name of the lab.
704
+ # @param expand [String] Specify the $expand query. Example:
705
+ # 'properties($select=email)'
706
+ # @param filter [String] The filter to apply to the operation.
707
+ # @param top [Integer] The maximum number of resources to return from the
708
+ # operation.
709
+ # @param orderby [String] The ordering expression for the results, using OData
710
+ # notation.
711
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
712
+ # will be added to the HTTP request.
713
+ #
714
+ # @return [ResponseWithContinuationUser] which provide lazy access to pages of
715
+ # the response.
716
+ #
717
+ def list_as_lazy(resource_group_name, lab_account_name, lab_name, expand:nil, filter:nil, top:nil, orderby:nil, custom_headers:nil)
718
+ response = list_async(resource_group_name, lab_account_name, lab_name, expand:expand, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers).value!
719
+ unless response.nil?
720
+ page = response.body
721
+ page.next_method = Proc.new do |next_page_link|
722
+ list_next_async(next_page_link, custom_headers:custom_headers)
723
+ end
724
+ page
725
+ end
726
+ end
727
+
728
+ end
729
+ end