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