azure_mgmt_devtestlabs 0.4.0

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