Class: Azure::ServiceFabric::Mgmt::V2018_02_01::Clusters

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb

Overview

Azure Service Fabric Resource Provider API Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Clusters

Creates and initializes a new instance of the Clusters class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientServiceFabricManagementClient (readonly)

Returns reference to the ServiceFabricManagementClient.

Returns:



22
23
24
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 22

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Cluster

Creates or updates a Service Fabric cluster resource.

Create or update a Service Fabric cluster resource with the specified name.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (Cluster)

    The cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cluster)

    operation results.



518
519
520
521
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 518

def begin_create(resource_group_name, cluster_name, parameters, custom_headers:nil)
  response = begin_create_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_async(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a Service Fabric cluster resource.

Create or update a Service Fabric cluster resource with the specified name.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (Cluster)

    The cluster resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 553

def begin_create_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:put, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_create_with_http_info(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a Service Fabric cluster resource.

Create or update a Service Fabric cluster resource with the specified name.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (Cluster)

    The cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



536
537
538
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 536

def begin_create_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil)
  begin_create_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Cluster

Updates the configuration of a Service Fabric cluster resource.

Update the configuration of a Service Fabric cluster resource with the specified name.

property value and property name which used to update the cluster configuration. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (ClusterUpdateParameters)

    The parameters which contains the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cluster)

    operation results.



640
641
642
643
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 640

def begin_update(resource_group_name, cluster_name, parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_update_async(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Updates the configuration of a Service Fabric cluster resource.

Update the configuration of a Service Fabric cluster resource with the specified name.

property value and property name which used to update the cluster configuration. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (ClusterUpdateParameters)

    The parameters which contains the

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 681

def begin_update_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterUpdateParameters.mapper()
  request_content = @client.serialize(request_mapper,  parameters)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:patch, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 202
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end
    # Deserialize Response
    if status_code == 202
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#begin_update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates the configuration of a Service Fabric cluster resource.

Update the configuration of a Service Fabric cluster resource with the specified name.

property value and property name which used to update the cluster configuration. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (ClusterUpdateParameters)

    The parameters which contains the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



661
662
663
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 661

def begin_update_with_http_info(resource_group_name, cluster_name, parameters, custom_headers:nil)
  begin_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
end

#create(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Cluster

Creates or updates a Service Fabric cluster resource.

Create or update a Service Fabric cluster resource with the specified name.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (Cluster)

    The cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cluster)

    operation results.



138
139
140
141
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 138

def create(resource_group_name, cluster_name, parameters, custom_headers:nil)
  response = create_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_async(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (Cluster)

    The cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 153

def create_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end

#delete(resource_group_name, cluster_name, custom_headers: nil) ⇒ Object

Deletes a Service Fabric cluster resource.

Delete a Service Fabric cluster resource with the specified name.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that



233
234
235
236
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 233

def delete(resource_group_name, cluster_name, custom_headers:nil)
  response = delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
  nil
end

#delete_async(resource_group_name, cluster_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a Service Fabric cluster resource.

Delete a Service Fabric cluster resource with the specified name.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 266

def delete_async(resource_group_name, cluster_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?

    result
  end

  promise.execute
end

#delete_with_http_info(resource_group_name, cluster_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a Service Fabric cluster resource.

Delete a Service Fabric cluster resource with the specified name.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



250
251
252
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 250

def delete_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
  delete_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
end

#get(resource_group_name, cluster_name, custom_headers: nil) ⇒ Cluster

Gets a Service Fabric cluster resource.

Get a Service Fabric cluster resource created or in the process of being created in the specified resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cluster)

    operation results.



37
38
39
40
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 37

def get(resource_group_name, cluster_name, custom_headers:nil)
  response = get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_async(resource_group_name, cluster_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets a Service Fabric cluster resource.

Get a Service Fabric cluster resource created or in the process of being created in the specified resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 72

def get_async(resource_group_name, cluster_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'cluster_name is nil' if cluster_name.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'clusterName' => cluster_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_with_http_info(resource_group_name, cluster_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a Service Fabric cluster resource.

Get a Service Fabric cluster resource created or in the process of being created in the specified resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



55
56
57
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 55

def get_with_http_info(resource_group_name, cluster_name, custom_headers:nil)
  get_async(resource_group_name, cluster_name, custom_headers:custom_headers).value!
end

#list(custom_headers: nil) ⇒ ClusterListResult

Gets the list of Service Fabric cluster resources created in the specified subscription.

Gets all Service Fabric cluster resources created or in the process of being created in the subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterListResult)

    operation results.



421
422
423
424
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 421

def list(custom_headers:nil)
  response = list_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_async(custom_headers: nil) ⇒ Concurrent::Promise

Gets the list of Service Fabric cluster resources created in the specified subscription.

Gets all Service Fabric cluster resources created or in the process of being created in the subscription.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 454

def list_async(custom_headers:nil)
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group(resource_group_name, custom_headers: nil) ⇒ ClusterListResult

Gets the list of Service Fabric cluster resources created in the specified resource group.

Gets all Service Fabric cluster resources created or in the process of being created in the resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (ClusterListResult)

    operation results.



322
323
324
325
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 322

def list_by_resource_group(resource_group_name, custom_headers:nil)
  response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_resource_group_async(resource_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Gets the list of Service Fabric cluster resources created in the specified resource group.

Gets all Service Fabric cluster resources created or in the process of being created in the resource group.

to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 357

def list_by_resource_group_async(resource_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  @client.api_version = '2018-02-01'
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::ClusterListResult.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_by_resource_group_with_http_info(resource_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of Service Fabric cluster resources created in the specified resource group.

Gets all Service Fabric cluster resources created or in the process of being created in the resource group.

will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



340
341
342
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 340

def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
  list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
end

#list_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets the list of Service Fabric cluster resources created in the specified subscription.

Gets all Service Fabric cluster resources created or in the process of being created in the subscription.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



438
439
440
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 438

def list_with_http_info(custom_headers:nil)
  list_async(custom_headers:custom_headers).value!
end

#update(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Cluster

Updates the configuration of a Service Fabric cluster resource.

Update the configuration of a Service Fabric cluster resource with the specified name.

property value and property name which used to update the cluster configuration. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (ClusterUpdateParameters)

    The parameters which contains the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Cluster)

    operation results.



187
188
189
190
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 187

def update(resource_group_name, cluster_name, parameters, custom_headers:nil)
  response = update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#update_async(resource_group_name, cluster_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

property value and property name which used to update the cluster configuration. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group.

  • cluster_name (String)

    The name of the cluster resource.

  • parameters (ClusterUpdateParameters)

    The parameters which contains the

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/2018-02-01/generated/azure_mgmt_service_fabric/clusters.rb', line 204

def update_async(resource_group_name, cluster_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, cluster_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::ServiceFabric::Mgmt::V2018_02_01::Models::Cluster.mapper()
      parsed_response = @client.deserialize(result_mapper, parsed_response)
    end

    # Waiting for response.
    @client.get_long_running_operation_result(response, deserialize_method)
  end

  promise
end