azure_mgmt_labservices 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2018-10-15/generated/azure_mgmt_labservices.rb +109 -0
  4. data/lib/2018-10-15/generated/azure_mgmt_labservices/environment_settings.rb +1254 -0
  5. data/lib/2018-10-15/generated/azure_mgmt_labservices/environments.rb +1286 -0
  6. data/lib/2018-10-15/generated/azure_mgmt_labservices/gallery_images.rb +672 -0
  7. data/lib/2018-10-15/generated/azure_mgmt_labservices/global_users.rb +1131 -0
  8. data/lib/2018-10-15/generated/azure_mgmt_labservices/lab_accounts.rb +1093 -0
  9. data/lib/2018-10-15/generated/azure_mgmt_labservices/labs.rb +890 -0
  10. data/lib/2018-10-15/generated/azure_mgmt_labservices/managed_labs_client.rb +163 -0
  11. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/add_remove.rb +16 -0
  12. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/add_users_payload.rb +55 -0
  13. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/configuration_state.rb +16 -0
  14. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/create_lab_properties.rb +101 -0
  15. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment.rb +235 -0
  16. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_details.rb +149 -0
  17. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_fragment.rb +121 -0
  18. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_operations_payload.rb +47 -0
  19. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting.rb +210 -0
  20. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting_creation_parameters.rb +48 -0
  21. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_setting_fragment.rb +157 -0
  22. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_size.rb +110 -0
  23. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/environment_size_fragment.rb +69 -0
  24. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image.rb +231 -0
  25. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_fragment.rb +143 -0
  26. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_reference.rb +90 -0
  27. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/gallery_image_reference_fragment.rb +90 -0
  28. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_environment_response.rb +48 -0
  29. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_personal_preferences_response.rb +65 -0
  30. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/get_regional_availability_response.rb +56 -0
  31. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab.rb +219 -0
  32. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_account.rb +147 -0
  33. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_account_fragment.rb +119 -0
  34. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_creation_parameters.rb +46 -0
  35. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_details.rb +82 -0
  36. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_fragment.rb +144 -0
  37. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/lab_user_access_mode.rb +16 -0
  38. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/latest_operation_result.rb +107 -0
  39. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_environments_payload.rb +46 -0
  40. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_environments_response.rb +55 -0
  41. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/list_labs_response.rb +55 -0
  42. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/managed_lab_vm_size.rb +17 -0
  43. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/network_interface.rb +83 -0
  44. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_payload.rb +54 -0
  45. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_response.rb +57 -0
  46. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_batch_status_response_item.rb +61 -0
  47. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_error.rb +57 -0
  48. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_metadata.rb +59 -0
  49. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_metadata_display.rb +80 -0
  50. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_result.rb +59 -0
  51. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_status_payload.rb +46 -0
  52. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/operation_status_response.rb +48 -0
  53. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/personal_preferences_operations_payload.rb +71 -0
  54. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/provider_operation_result.rb +101 -0
  55. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/publish_payload.rb +47 -0
  56. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/publishing_state.rb +19 -0
  57. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm.rb +84 -0
  58. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm_creation_parameters.rb +57 -0
  59. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reference_vm_fragment.rb +58 -0
  60. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/regional_availability.rb +67 -0
  61. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/register_payload.rb +46 -0
  62. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/reset_password_payload.rb +68 -0
  63. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource.rb +110 -0
  64. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_set.rb +57 -0
  65. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_set_fragment.rb +57 -0
  66. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_setting_creation_parameters.rb +94 -0
  67. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_settings.rb +108 -0
  68. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/resource_settings_fragment.rb +71 -0
  69. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_environment.rb +98 -0
  70. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_environment_setting.rb +100 -0
  71. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_gallery_image.rb +98 -0
  72. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_lab.rb +98 -0
  73. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_lab_account.rb +98 -0
  74. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/response_with_continuation_user.rb +98 -0
  75. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_availability.rb +59 -0
  76. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_configuration_properties.rb +56 -0
  77. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_configuration_properties_fragment.rb +56 -0
  78. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_info.rb +82 -0
  79. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/size_info_fragment.rb +82 -0
  80. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/user.rb +186 -0
  81. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/user_fragment.rb +108 -0
  82. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/virtual_machine_details.rb +107 -0
  83. data/lib/2018-10-15/generated/azure_mgmt_labservices/models/vm_state_details.rb +86 -0
  84. data/lib/2018-10-15/generated/azure_mgmt_labservices/module_definition.rb +9 -0
  85. data/lib/2018-10-15/generated/azure_mgmt_labservices/operations.rb +117 -0
  86. data/lib/2018-10-15/generated/azure_mgmt_labservices/provider_operations.rb +215 -0
  87. data/lib/2018-10-15/generated/azure_mgmt_labservices/users.rb +729 -0
  88. data/lib/azure_mgmt_labservices.rb +6 -0
  89. data/lib/module_definition.rb +7 -0
  90. data/lib/profiles/latest/labservices_latest_profile_client.rb +40 -0
  91. data/lib/profiles/latest/labservices_module_definition.rb +8 -0
  92. data/lib/profiles/latest/modules/labservices_profile_module.rb +369 -0
  93. data/lib/version.rb +7 -0
  94. metadata +210 -0
@@ -0,0 +1,672 @@
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 GalleryImages
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the GalleryImages 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 gallery images 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=author)'
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<GalleryImage>] 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 gallery images 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=author)'
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 gallery images 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=author)'
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}/galleryimages'
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::ResponseWithContinuationGalleryImage.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 gallery image
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 gallery_image_name [String] The name of the gallery Image.
143
+ # @param expand [String] Specify the $expand query. Example:
144
+ # 'properties($select=author)'
145
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
146
+ # will be added to the HTTP request.
147
+ #
148
+ # @return [GalleryImage] operation results.
149
+ #
150
+ def get(resource_group_name, lab_account_name, gallery_image_name, expand:nil, custom_headers:nil)
151
+ response = get_async(resource_group_name, lab_account_name, gallery_image_name, expand:expand, custom_headers:custom_headers).value!
152
+ response.body unless response.nil?
153
+ end
154
+
155
+ #
156
+ # Get gallery image
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 gallery_image_name [String] The name of the gallery Image.
161
+ # @param expand [String] Specify the $expand query. Example:
162
+ # 'properties($select=author)'
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, gallery_image_name, expand:nil, custom_headers:nil)
169
+ get_async(resource_group_name, lab_account_name, gallery_image_name, expand:expand, custom_headers:custom_headers).value!
170
+ end
171
+
172
+ #
173
+ # Get gallery image
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 gallery_image_name [String] The name of the gallery Image.
178
+ # @param expand [String] Specify the $expand query. Example:
179
+ # 'properties($select=author)'
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, gallery_image_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, 'gallery_image_name is nil' if gallery_image_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}/galleryimages/{galleryImageName}'
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,'galleryImageName' => gallery_image_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::GalleryImage.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 Gallery Image.
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 gallery_image_name [String] The name of the gallery Image.
245
+ # @param gallery_image [GalleryImage] Represents an image from the Azure
246
+ # Marketplace
247
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
248
+ # will be added to the HTTP request.
249
+ #
250
+ # @return [GalleryImage] operation results.
251
+ #
252
+ def create_or_update(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
253
+ response = create_or_update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
254
+ response.body unless response.nil?
255
+ end
256
+
257
+ #
258
+ # Create or replace an existing Gallery Image.
259
+ #
260
+ # @param resource_group_name [String] The name of the resource group.
261
+ # @param lab_account_name [String] The name of the lab Account.
262
+ # @param gallery_image_name [String] The name of the gallery Image.
263
+ # @param gallery_image [GalleryImage] Represents an image from the Azure
264
+ # Marketplace
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
269
+ #
270
+ def create_or_update_with_http_info(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
271
+ create_or_update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
272
+ end
273
+
274
+ #
275
+ # Create or replace an existing Gallery Image.
276
+ #
277
+ # @param resource_group_name [String] The name of the resource group.
278
+ # @param lab_account_name [String] The name of the lab Account.
279
+ # @param gallery_image_name [String] The name of the gallery Image.
280
+ # @param gallery_image [GalleryImage] Represents an image from the Azure
281
+ # Marketplace
282
+ # @param [Hash{String => String}] A hash of custom headers that will be added
283
+ # to the HTTP request.
284
+ #
285
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
286
+ #
287
+ def create_or_update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
288
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
289
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
290
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
291
+ fail ArgumentError, 'gallery_image_name is nil' if gallery_image_name.nil?
292
+ fail ArgumentError, 'gallery_image is nil' if gallery_image.nil?
293
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
294
+
295
+
296
+ request_headers = {}
297
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
298
+
299
+ # Set Headers
300
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
301
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
302
+
303
+ # Serialize Request
304
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GalleryImage.mapper()
305
+ request_content = @client.serialize(request_mapper, gallery_image)
306
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
307
+
308
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'
309
+
310
+ request_url = @base_url || @client.base_url
311
+
312
+ options = {
313
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
314
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'galleryImageName' => gallery_image_name},
315
+ query_params: {'api-version' => @client.api_version},
316
+ body: request_content,
317
+ headers: request_headers.merge(custom_headers || {}),
318
+ base_url: request_url
319
+ }
320
+ promise = @client.make_request_async(:put, path_template, options)
321
+
322
+ promise = promise.then do |result|
323
+ http_response = result.response
324
+ status_code = http_response.status
325
+ response_content = http_response.body
326
+ unless status_code == 200 || status_code == 201
327
+ error_model = JSON.load(response_content)
328
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
329
+ end
330
+
331
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
332
+ # Deserialize Response
333
+ if status_code == 200
334
+ begin
335
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
336
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GalleryImage.mapper()
337
+ result.body = @client.deserialize(result_mapper, parsed_response)
338
+ rescue Exception => e
339
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
340
+ end
341
+ end
342
+ # Deserialize Response
343
+ if status_code == 201
344
+ begin
345
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
346
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GalleryImage.mapper()
347
+ result.body = @client.deserialize(result_mapper, parsed_response)
348
+ rescue Exception => e
349
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
350
+ end
351
+ end
352
+
353
+ result
354
+ end
355
+
356
+ promise.execute
357
+ end
358
+
359
+ #
360
+ # Delete gallery image.
361
+ #
362
+ # @param resource_group_name [String] The name of the resource group.
363
+ # @param lab_account_name [String] The name of the lab Account.
364
+ # @param gallery_image_name [String] The name of the gallery Image.
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ #
369
+ def delete(resource_group_name, lab_account_name, gallery_image_name, custom_headers:nil)
370
+ response = delete_async(resource_group_name, lab_account_name, gallery_image_name, custom_headers:custom_headers).value!
371
+ nil
372
+ end
373
+
374
+ #
375
+ # Delete gallery image.
376
+ #
377
+ # @param resource_group_name [String] The name of the resource group.
378
+ # @param lab_account_name [String] The name of the lab Account.
379
+ # @param gallery_image_name [String] The name of the gallery Image.
380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
381
+ # will be added to the HTTP request.
382
+ #
383
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
384
+ #
385
+ def delete_with_http_info(resource_group_name, lab_account_name, gallery_image_name, custom_headers:nil)
386
+ delete_async(resource_group_name, lab_account_name, gallery_image_name, custom_headers:custom_headers).value!
387
+ end
388
+
389
+ #
390
+ # Delete gallery image.
391
+ #
392
+ # @param resource_group_name [String] The name of the resource group.
393
+ # @param lab_account_name [String] The name of the lab Account.
394
+ # @param gallery_image_name [String] The name of the gallery Image.
395
+ # @param [Hash{String => String}] A hash of custom headers that will be added
396
+ # to the HTTP request.
397
+ #
398
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
399
+ #
400
+ def delete_async(resource_group_name, lab_account_name, gallery_image_name, custom_headers:nil)
401
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
402
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
403
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
404
+ fail ArgumentError, 'gallery_image_name is nil' if gallery_image_name.nil?
405
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
406
+
407
+
408
+ request_headers = {}
409
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
410
+
411
+ # Set Headers
412
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
413
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
414
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'
415
+
416
+ request_url = @base_url || @client.base_url
417
+
418
+ options = {
419
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
420
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'galleryImageName' => gallery_image_name},
421
+ query_params: {'api-version' => @client.api_version},
422
+ headers: request_headers.merge(custom_headers || {}),
423
+ base_url: request_url
424
+ }
425
+ promise = @client.make_request_async(:delete, path_template, options)
426
+
427
+ promise = promise.then do |result|
428
+ http_response = result.response
429
+ status_code = http_response.status
430
+ response_content = http_response.body
431
+ unless status_code == 200 || status_code == 204
432
+ error_model = JSON.load(response_content)
433
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
434
+ end
435
+
436
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
437
+
438
+ result
439
+ end
440
+
441
+ promise.execute
442
+ end
443
+
444
+ #
445
+ # Modify properties of gallery images.
446
+ #
447
+ # @param resource_group_name [String] The name of the resource group.
448
+ # @param lab_account_name [String] The name of the lab Account.
449
+ # @param gallery_image_name [String] The name of the gallery Image.
450
+ # @param gallery_image [GalleryImageFragment] Represents an image from the
451
+ # Azure Marketplace
452
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
453
+ # will be added to the HTTP request.
454
+ #
455
+ # @return [GalleryImage] operation results.
456
+ #
457
+ def update(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
458
+ response = update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
459
+ response.body unless response.nil?
460
+ end
461
+
462
+ #
463
+ # Modify properties of gallery images.
464
+ #
465
+ # @param resource_group_name [String] The name of the resource group.
466
+ # @param lab_account_name [String] The name of the lab Account.
467
+ # @param gallery_image_name [String] The name of the gallery Image.
468
+ # @param gallery_image [GalleryImageFragment] Represents an image from the
469
+ # Azure Marketplace
470
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
471
+ # will be added to the HTTP request.
472
+ #
473
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
474
+ #
475
+ def update_with_http_info(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
476
+ update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:custom_headers).value!
477
+ end
478
+
479
+ #
480
+ # Modify properties of gallery images.
481
+ #
482
+ # @param resource_group_name [String] The name of the resource group.
483
+ # @param lab_account_name [String] The name of the lab Account.
484
+ # @param gallery_image_name [String] The name of the gallery Image.
485
+ # @param gallery_image [GalleryImageFragment] Represents an image from the
486
+ # Azure Marketplace
487
+ # @param [Hash{String => String}] A hash of custom headers that will be added
488
+ # to the HTTP request.
489
+ #
490
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
491
+ #
492
+ def update_async(resource_group_name, lab_account_name, gallery_image_name, gallery_image, custom_headers:nil)
493
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
494
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
495
+ fail ArgumentError, 'lab_account_name is nil' if lab_account_name.nil?
496
+ fail ArgumentError, 'gallery_image_name is nil' if gallery_image_name.nil?
497
+ fail ArgumentError, 'gallery_image is nil' if gallery_image.nil?
498
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
499
+
500
+
501
+ request_headers = {}
502
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
503
+
504
+ # Set Headers
505
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
506
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
507
+
508
+ # Serialize Request
509
+ request_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GalleryImageFragment.mapper()
510
+ request_content = @client.serialize(request_mapper, gallery_image)
511
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
512
+
513
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LabServices/labaccounts/{labAccountName}/galleryimages/{galleryImageName}'
514
+
515
+ request_url = @base_url || @client.base_url
516
+
517
+ options = {
518
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
519
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'labAccountName' => lab_account_name,'galleryImageName' => gallery_image_name},
520
+ query_params: {'api-version' => @client.api_version},
521
+ body: request_content,
522
+ headers: request_headers.merge(custom_headers || {}),
523
+ base_url: request_url
524
+ }
525
+ promise = @client.make_request_async(:patch, path_template, options)
526
+
527
+ promise = promise.then do |result|
528
+ http_response = result.response
529
+ status_code = http_response.status
530
+ response_content = http_response.body
531
+ unless status_code == 200
532
+ error_model = JSON.load(response_content)
533
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
534
+ end
535
+
536
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
537
+ # Deserialize Response
538
+ if status_code == 200
539
+ begin
540
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
541
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::GalleryImage.mapper()
542
+ result.body = @client.deserialize(result_mapper, parsed_response)
543
+ rescue Exception => e
544
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
545
+ end
546
+ end
547
+
548
+ result
549
+ end
550
+
551
+ promise.execute
552
+ end
553
+
554
+ #
555
+ # List gallery images in a given lab account.
556
+ #
557
+ # @param next_page_link [String] The NextLink from the previous successful call
558
+ # to List operation.
559
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
560
+ # will be added to the HTTP request.
561
+ #
562
+ # @return [ResponseWithContinuationGalleryImage] operation results.
563
+ #
564
+ def list_next(next_page_link, custom_headers:nil)
565
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
566
+ response.body unless response.nil?
567
+ end
568
+
569
+ #
570
+ # List gallery images in a given lab account.
571
+ #
572
+ # @param next_page_link [String] The NextLink from the previous successful call
573
+ # to List operation.
574
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
575
+ # will be added to the HTTP request.
576
+ #
577
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
578
+ #
579
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
580
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
581
+ end
582
+
583
+ #
584
+ # List gallery images in a given lab account.
585
+ #
586
+ # @param next_page_link [String] The NextLink from the previous successful call
587
+ # to List operation.
588
+ # @param [Hash{String => String}] A hash of custom headers that will be added
589
+ # to the HTTP request.
590
+ #
591
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
592
+ #
593
+ def list_next_async(next_page_link, custom_headers:nil)
594
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
595
+
596
+
597
+ request_headers = {}
598
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
599
+
600
+ # Set Headers
601
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
602
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
603
+ path_template = '{nextLink}'
604
+
605
+ request_url = @base_url || @client.base_url
606
+
607
+ options = {
608
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
609
+ skip_encoding_path_params: {'nextLink' => next_page_link},
610
+ headers: request_headers.merge(custom_headers || {}),
611
+ base_url: request_url
612
+ }
613
+ promise = @client.make_request_async(:get, path_template, options)
614
+
615
+ promise = promise.then do |result|
616
+ http_response = result.response
617
+ status_code = http_response.status
618
+ response_content = http_response.body
619
+ unless status_code == 200
620
+ error_model = JSON.load(response_content)
621
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
622
+ end
623
+
624
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
625
+ # Deserialize Response
626
+ if status_code == 200
627
+ begin
628
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
629
+ result_mapper = Azure::Labservices::Mgmt::V2018_10_15::Models::ResponseWithContinuationGalleryImage.mapper()
630
+ result.body = @client.deserialize(result_mapper, parsed_response)
631
+ rescue Exception => e
632
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
633
+ end
634
+ end
635
+
636
+ result
637
+ end
638
+
639
+ promise.execute
640
+ end
641
+
642
+ #
643
+ # List gallery images in a given lab account.
644
+ #
645
+ # @param resource_group_name [String] The name of the resource group.
646
+ # @param lab_account_name [String] The name of the lab Account.
647
+ # @param expand [String] Specify the $expand query. Example:
648
+ # 'properties($select=author)'
649
+ # @param filter [String] The filter to apply to the operation.
650
+ # @param top [Integer] The maximum number of resources to return from the
651
+ # operation.
652
+ # @param orderby [String] The ordering expression for the results, using OData
653
+ # notation.
654
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
655
+ # will be added to the HTTP request.
656
+ #
657
+ # @return [ResponseWithContinuationGalleryImage] which provide lazy access to
658
+ # pages of the response.
659
+ #
660
+ def list_as_lazy(resource_group_name, lab_account_name, expand:nil, filter:nil, top:nil, orderby:nil, custom_headers:nil)
661
+ response = list_async(resource_group_name, lab_account_name, expand:expand, filter:filter, top:top, orderby:orderby, custom_headers:custom_headers).value!
662
+ unless response.nil?
663
+ page = response.body
664
+ page.next_method = Proc.new do |next_page_link|
665
+ list_next_async(next_page_link, custom_headers:custom_headers)
666
+ end
667
+ page
668
+ end
669
+ end
670
+
671
+ end
672
+ end