azure_mgmt_service_fabric 0.14.0

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