azure_mgmt_vmware_cloudsimple 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple.rb +82 -0
  4. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/dedicated_cloud_nodes.rb +945 -0
  5. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/dedicated_cloud_services.rb +932 -0
  6. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/aggregation_type.rb +16 -0
  7. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation.rb +99 -0
  8. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display.rb +79 -0
  9. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display_property_service_specification_metrics_item.rb +94 -0
  10. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operation_display_property_service_specification_metrics_list.rb +60 -0
  11. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/available_operations_list_response.rb +99 -0
  12. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/csrperror.rb +47 -0
  13. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/csrperror_body.rb +91 -0
  14. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_node.rb +293 -0
  15. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_node_list_response.rb +99 -0
  16. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_service.rb +154 -0
  17. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/dedicated_cloud_service_list_response.rb +99 -0
  18. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/disk_independence_mode.rb +17 -0
  19. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/guest_ostype.rb +17 -0
  20. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/nictype.rb +20 -0
  21. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/node_status.rb +16 -0
  22. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/onboarding_status.rb +18 -0
  23. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_error.rb +57 -0
  24. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_origin.rb +17 -0
  25. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/operation_resource.rb +107 -0
  26. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/patch_payload.rb +54 -0
  27. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud.rb +382 -0
  28. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud_list.rb +98 -0
  29. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/private_cloud_resource_type.rb +15 -0
  30. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/resource_pool.rb +106 -0
  31. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/resource_pools_list_response.rb +98 -0
  32. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku.rb +93 -0
  33. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku_availability.rb +124 -0
  34. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/sku_availability_list_response.rb +99 -0
  35. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/stop_mode.rb +18 -0
  36. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage.rb +87 -0
  37. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_count.rb +20 -0
  38. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_list_response.rb +99 -0
  39. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/usage_name.rb +58 -0
  40. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_disk.rb +94 -0
  41. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_disk_controller.rb +84 -0
  42. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine.rb +388 -0
  43. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_list_response.rb +98 -0
  44. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_status.rb +20 -0
  45. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_stop_mode.rb +49 -0
  46. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_template.rb +283 -0
  47. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_machine_template_list_response.rb +98 -0
  48. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_network.rb +106 -0
  49. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_network_list_response.rb +98 -0
  50. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/models/virtual_nic.rb +124 -0
  51. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/module_definition.rb +9 -0
  52. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/operations.rb +335 -0
  53. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/private_clouds.rb +340 -0
  54. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/resource_pools.rb +349 -0
  55. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/skus_availability.rb +248 -0
  56. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/usages.rb +248 -0
  57. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_machine_templates.rb +361 -0
  58. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_machines.rb +1326 -0
  59. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/virtual_networks.rb +358 -0
  60. data/lib/2019-04-01/generated/azure_mgmt_vmware_cloudsimple/vmware_cloud_simple_client.rb +170 -0
  61. data/lib/azure_mgmt_vmware_cloudsimple.rb +6 -0
  62. data/lib/module_definition.rb +7 -0
  63. data/lib/profiles/latest/modules/vmwarecloudsimple_profile_module.rb +259 -0
  64. data/lib/profiles/latest/vmwarecloudsimple_latest_profile_client.rb +40 -0
  65. data/lib/profiles/latest/vmwarecloudsimple_module_definition.rb +8 -0
  66. data/lib/version.rb +7 -0
  67. metadata +182 -0
@@ -0,0 +1,358 @@
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::VMwareCloudSimple::Mgmt::V2019_04_01
7
+ #
8
+ # Description of the new service
9
+ #
10
+ class VirtualNetworks
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the VirtualNetworks class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [VMwareCloudSimpleClient] reference to the VMwareCloudSimpleClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Implements list available virtual networks within a subscription method
26
+ #
27
+ # Return list of virtual networks in location for private cloud
28
+ #
29
+ # @param region_id [String] The region Id (westus, eastus)
30
+ # @param pc_name [String] The private cloud name
31
+ # @param resource_pool_name [String] Resource pool used to derive vSphere
32
+ # cluster which contains virtual networks
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ # @return [Array<VirtualNetwork>] operation results.
37
+ #
38
+ def list(region_id, pc_name, resource_pool_name, custom_headers:nil)
39
+ first_page = list_as_lazy(region_id, pc_name, resource_pool_name, custom_headers:custom_headers)
40
+ first_page.get_all_items
41
+ end
42
+
43
+ #
44
+ # Implements list available virtual networks within a subscription method
45
+ #
46
+ # Return list of virtual networks in location for private cloud
47
+ #
48
+ # @param region_id [String] The region Id (westus, eastus)
49
+ # @param pc_name [String] The private cloud name
50
+ # @param resource_pool_name [String] Resource pool used to derive vSphere
51
+ # cluster which contains virtual networks
52
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
53
+ # will be added to the HTTP request.
54
+ #
55
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
56
+ #
57
+ def list_with_http_info(region_id, pc_name, resource_pool_name, custom_headers:nil)
58
+ list_async(region_id, pc_name, resource_pool_name, custom_headers:custom_headers).value!
59
+ end
60
+
61
+ #
62
+ # Implements list available virtual networks within a subscription method
63
+ #
64
+ # Return list of virtual networks in location for private cloud
65
+ #
66
+ # @param region_id [String] The region Id (westus, eastus)
67
+ # @param pc_name [String] The private cloud name
68
+ # @param resource_pool_name [String] Resource pool used to derive vSphere
69
+ # cluster which contains virtual networks
70
+ # @param [Hash{String => String}] A hash of custom headers that will be added
71
+ # to the HTTP request.
72
+ #
73
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
74
+ #
75
+ def list_async(region_id, pc_name, resource_pool_name, custom_headers:nil)
76
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
77
+ fail ArgumentError, 'region_id is nil' if region_id.nil?
78
+ fail ArgumentError, 'pc_name is nil' if pc_name.nil?
79
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
80
+ fail ArgumentError, 'resource_pool_name is nil' if resource_pool_name.nil?
81
+
82
+
83
+ request_headers = {}
84
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
85
+
86
+ # Set Headers
87
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
88
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
89
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks'
90
+
91
+ request_url = @base_url || @client.base_url
92
+
93
+ options = {
94
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
95
+ path_params: {'subscriptionId' => @client.subscription_id,'regionId' => region_id,'pcName' => pc_name},
96
+ query_params: {'api-version' => @client.api_version,'resourcePoolName' => resource_pool_name},
97
+ headers: request_headers.merge(custom_headers || {}),
98
+ base_url: request_url
99
+ }
100
+ promise = @client.make_request_async(:get, path_template, options)
101
+
102
+ promise = promise.then do |result|
103
+ http_response = result.response
104
+ status_code = http_response.status
105
+ response_content = http_response.body
106
+ unless status_code == 200
107
+ error_model = JSON.load(response_content)
108
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
109
+ end
110
+
111
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
112
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
113
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
114
+ # Deserialize Response
115
+ if status_code == 200
116
+ begin
117
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
118
+ result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::VirtualNetworkListResponse.mapper()
119
+ result.body = @client.deserialize(result_mapper, parsed_response)
120
+ rescue Exception => e
121
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
122
+ end
123
+ end
124
+
125
+ result
126
+ end
127
+
128
+ promise.execute
129
+ end
130
+
131
+ #
132
+ # Implements virtual network GET method
133
+ #
134
+ # Return virtual network by its name
135
+ #
136
+ # @param region_id [String] The region Id (westus, eastus)
137
+ # @param pc_name [String] The private cloud name
138
+ # @param virtual_network_name [String] virtual network id (vsphereId)
139
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
140
+ # will be added to the HTTP request.
141
+ #
142
+ # @return [VirtualNetwork] operation results.
143
+ #
144
+ def get(region_id, pc_name, virtual_network_name, custom_headers:nil)
145
+ response = get_async(region_id, pc_name, virtual_network_name, custom_headers:custom_headers).value!
146
+ response.body unless response.nil?
147
+ end
148
+
149
+ #
150
+ # Implements virtual network GET method
151
+ #
152
+ # Return virtual network by its name
153
+ #
154
+ # @param region_id [String] The region Id (westus, eastus)
155
+ # @param pc_name [String] The private cloud name
156
+ # @param virtual_network_name [String] virtual network id (vsphereId)
157
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
158
+ # will be added to the HTTP request.
159
+ #
160
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
161
+ #
162
+ def get_with_http_info(region_id, pc_name, virtual_network_name, custom_headers:nil)
163
+ get_async(region_id, pc_name, virtual_network_name, custom_headers:custom_headers).value!
164
+ end
165
+
166
+ #
167
+ # Implements virtual network GET method
168
+ #
169
+ # Return virtual network by its name
170
+ #
171
+ # @param region_id [String] The region Id (westus, eastus)
172
+ # @param pc_name [String] The private cloud name
173
+ # @param virtual_network_name [String] virtual network id (vsphereId)
174
+ # @param [Hash{String => String}] A hash of custom headers that will be added
175
+ # to the HTTP request.
176
+ #
177
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
178
+ #
179
+ def get_async(region_id, pc_name, virtual_network_name, custom_headers:nil)
180
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
181
+ fail ArgumentError, 'region_id is nil' if region_id.nil?
182
+ fail ArgumentError, 'pc_name is nil' if pc_name.nil?
183
+ fail ArgumentError, 'virtual_network_name is nil' if virtual_network_name.nil?
184
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
185
+
186
+
187
+ request_headers = {}
188
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
189
+
190
+ # Set Headers
191
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
192
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
193
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.VMwareCloudSimple/locations/{regionId}/privateClouds/{pcName}/virtualNetworks/{virtualNetworkName}'
194
+
195
+ request_url = @base_url || @client.base_url
196
+
197
+ options = {
198
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
199
+ path_params: {'subscriptionId' => @client.subscription_id,'regionId' => region_id,'pcName' => pc_name,'virtualNetworkName' => virtual_network_name},
200
+ query_params: {'api-version' => @client.api_version},
201
+ headers: request_headers.merge(custom_headers || {}),
202
+ base_url: request_url
203
+ }
204
+ promise = @client.make_request_async(:get, path_template, options)
205
+
206
+ promise = promise.then do |result|
207
+ http_response = result.response
208
+ status_code = http_response.status
209
+ response_content = http_response.body
210
+ unless status_code == 200
211
+ error_model = JSON.load(response_content)
212
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
213
+ end
214
+
215
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
216
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
217
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
218
+ # Deserialize Response
219
+ if status_code == 200
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::VirtualNetwork.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response)
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Implements list available virtual networks within a subscription method
237
+ #
238
+ # Return list of virtual networks in location for private cloud
239
+ #
240
+ # @param next_page_link [String] The NextLink from the previous successful call
241
+ # to List operation.
242
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
243
+ # will be added to the HTTP request.
244
+ #
245
+ # @return [VirtualNetworkListResponse] operation results.
246
+ #
247
+ def list_next(next_page_link, custom_headers:nil)
248
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
249
+ response.body unless response.nil?
250
+ end
251
+
252
+ #
253
+ # Implements list available virtual networks within a subscription method
254
+ #
255
+ # Return list of virtual networks in location for private cloud
256
+ #
257
+ # @param next_page_link [String] The NextLink from the previous successful call
258
+ # to List operation.
259
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
260
+ # will be added to the HTTP request.
261
+ #
262
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
263
+ #
264
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
265
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
266
+ end
267
+
268
+ #
269
+ # Implements list available virtual networks within a subscription method
270
+ #
271
+ # Return list of virtual networks in location for private cloud
272
+ #
273
+ # @param next_page_link [String] The NextLink from the previous successful call
274
+ # to List operation.
275
+ # @param [Hash{String => String}] A hash of custom headers that will be added
276
+ # to the HTTP request.
277
+ #
278
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
279
+ #
280
+ def list_next_async(next_page_link, custom_headers:nil)
281
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
282
+
283
+
284
+ request_headers = {}
285
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
286
+
287
+ # Set Headers
288
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
289
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
290
+ path_template = '{nextLink}'
291
+
292
+ request_url = @base_url || @client.base_url
293
+
294
+ options = {
295
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
296
+ skip_encoding_path_params: {'nextLink' => next_page_link},
297
+ headers: request_headers.merge(custom_headers || {}),
298
+ base_url: request_url
299
+ }
300
+ promise = @client.make_request_async(:get, path_template, options)
301
+
302
+ promise = promise.then do |result|
303
+ http_response = result.response
304
+ status_code = http_response.status
305
+ response_content = http_response.body
306
+ unless status_code == 200
307
+ error_model = JSON.load(response_content)
308
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
309
+ end
310
+
311
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
312
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
313
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
314
+ # Deserialize Response
315
+ if status_code == 200
316
+ begin
317
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
318
+ result_mapper = Azure::VMwareCloudSimple::Mgmt::V2019_04_01::Models::VirtualNetworkListResponse.mapper()
319
+ result.body = @client.deserialize(result_mapper, parsed_response)
320
+ rescue Exception => e
321
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
322
+ end
323
+ end
324
+
325
+ result
326
+ end
327
+
328
+ promise.execute
329
+ end
330
+
331
+ #
332
+ # Implements list available virtual networks within a subscription method
333
+ #
334
+ # Return list of virtual networks in location for private cloud
335
+ #
336
+ # @param region_id [String] The region Id (westus, eastus)
337
+ # @param pc_name [String] The private cloud name
338
+ # @param resource_pool_name [String] Resource pool used to derive vSphere
339
+ # cluster which contains virtual networks
340
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
341
+ # will be added to the HTTP request.
342
+ #
343
+ # @return [VirtualNetworkListResponse] which provide lazy access to pages of
344
+ # the response.
345
+ #
346
+ def list_as_lazy(region_id, pc_name, resource_pool_name, custom_headers:nil)
347
+ response = list_async(region_id, pc_name, resource_pool_name, custom_headers:custom_headers).value!
348
+ unless response.nil?
349
+ page = response.body
350
+ page.next_method = Proc.new do |next_page_link|
351
+ list_next_async(next_page_link, custom_headers:custom_headers)
352
+ end
353
+ page
354
+ end
355
+ end
356
+
357
+ end
358
+ end
@@ -0,0 +1,170 @@
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::VMwareCloudSimple::Mgmt::V2019_04_01
7
+ #
8
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class VMwareCloudSimpleClient < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] The subscription ID.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Client API version.
24
+ attr_reader :api_version
25
+
26
+ # @return [String] referer url
27
+ attr_accessor :referer
28
+
29
+ # @return [String] The preferred language for the response.
30
+ attr_accessor :accept_language
31
+
32
+ # @return [Integer] The retry timeout in seconds for Long Running
33
+ # Operations. Default value is 30.
34
+ attr_accessor :long_running_operation_retry_timeout
35
+
36
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
37
+ # generated. When set to true a unique x-ms-client-request-id value is
38
+ # generated and included in each request. Default is true.
39
+ attr_accessor :generate_client_request_id
40
+
41
+ # @return [Operations] operations
42
+ attr_reader :operations
43
+
44
+ # @return [DedicatedCloudNodes] dedicated_cloud_nodes
45
+ attr_reader :dedicated_cloud_nodes
46
+
47
+ # @return [DedicatedCloudServices] dedicated_cloud_services
48
+ attr_reader :dedicated_cloud_services
49
+
50
+ # @return [SkusAvailability] skus_availability
51
+ attr_reader :skus_availability
52
+
53
+ # @return [PrivateClouds] private_clouds
54
+ attr_reader :private_clouds
55
+
56
+ # @return [ResourcePools] resource_pools
57
+ attr_reader :resource_pools
58
+
59
+ # @return [VirtualMachineTemplates] virtual_machine_templates
60
+ attr_reader :virtual_machine_templates
61
+
62
+ # @return [VirtualNetworks] virtual_networks
63
+ attr_reader :virtual_networks
64
+
65
+ # @return [Usages] usages
66
+ attr_reader :usages
67
+
68
+ # @return [VirtualMachines] virtual_machines
69
+ attr_reader :virtual_machines
70
+
71
+ #
72
+ # Creates initializes a new instance of the VMwareCloudSimpleClient class.
73
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
74
+ # @param base_url [String] the base URI of the service.
75
+ # @param options [Array] filters to be applied to the HTTP requests.
76
+ #
77
+ def initialize(credentials = nil, base_url = nil, options = nil)
78
+ super(credentials, options)
79
+ @base_url = base_url || 'https://management.azure.com'
80
+
81
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
82
+ @credentials = credentials
83
+
84
+ @operations = Operations.new(self)
85
+ @dedicated_cloud_nodes = DedicatedCloudNodes.new(self)
86
+ @dedicated_cloud_services = DedicatedCloudServices.new(self)
87
+ @skus_availability = SkusAvailability.new(self)
88
+ @private_clouds = PrivateClouds.new(self)
89
+ @resource_pools = ResourcePools.new(self)
90
+ @virtual_machine_templates = VirtualMachineTemplates.new(self)
91
+ @virtual_networks = VirtualNetworks.new(self)
92
+ @usages = Usages.new(self)
93
+ @virtual_machines = VirtualMachines.new(self)
94
+ @api_version = '2019-04-01'
95
+ @accept_language = 'en-US'
96
+ @long_running_operation_retry_timeout = 30
97
+ @generate_client_request_id = true
98
+ add_telemetry
99
+ end
100
+
101
+ #
102
+ # Makes a request and returns the body of the response.
103
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
104
+ # @param path [String] the path, relative to {base_url}.
105
+ # @param options [Hash{String=>String}] specifying any request options like :body.
106
+ # @return [Hash{String=>String}] containing the body of the response.
107
+ # Example:
108
+ #
109
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
110
+ # path = "/path"
111
+ # options = {
112
+ # body: request_content,
113
+ # query_params: {'api-version' => '2016-02-01'}
114
+ # }
115
+ # result = @client.make_request(:put, path, options)
116
+ #
117
+ def make_request(method, path, options = {})
118
+ result = make_request_with_http_info(method, path, options)
119
+ result.body unless result.nil?
120
+ end
121
+
122
+ #
123
+ # Makes a request and returns the operation response.
124
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
125
+ # @param path [String] the path, relative to {base_url}.
126
+ # @param options [Hash{String=>String}] specifying any request options like :body.
127
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
128
+ #
129
+ def make_request_with_http_info(method, path, options = {})
130
+ result = make_request_async(method, path, options).value!
131
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
132
+ result
133
+ end
134
+
135
+ #
136
+ # Makes a request asynchronously.
137
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
138
+ # @param path [String] the path, relative to {base_url}.
139
+ # @param options [Hash{String=>String}] specifying any request options like :body.
140
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
141
+ #
142
+ def make_request_async(method, path, options = {})
143
+ fail ArgumentError, 'method is nil' if method.nil?
144
+ fail ArgumentError, 'path is nil' if path.nil?
145
+
146
+ request_url = options[:base_url] || @base_url
147
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
148
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
149
+ end
150
+
151
+ request_headers = @request_headers
152
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
153
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
154
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
155
+
156
+ super(request_url, method, path, options)
157
+ end
158
+
159
+
160
+ private
161
+ #
162
+ # Adds telemetry information.
163
+ #
164
+ def add_telemetry
165
+ sdk_information = 'azure_mgmt_vmware_cloudsimple'
166
+ sdk_information = "#{sdk_information}/0.17.0"
167
+ add_user_agent_information(sdk_information)
168
+ end
169
+ end
170
+ end