Class: Azure::SQL::Mgmt::V2015_05_01_preview::FailoverGroups

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb

Overview

The Azure SQL Database management API provides a RESTful set of web services that interact with Azure SQL Database services to manage your databases. The API enables you to create, retrieve, update, and delete databases.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ FailoverGroups

Creates and initializes a new instance of the FailoverGroups class.

Parameters:

  • client

    service class for accessing basic functionality.



20
21
22
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSqlManagementClient (readonly)

Returns reference to the SqlManagementClient.

Returns:



25
26
27
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 25

def client
  @client
end

Instance Method Details

#begin_create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ FailoverGroup

Creates or updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroup)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



503
504
505
506
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 503

def begin_create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

Creates or updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroup)

    The failover group parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



542
543
544
545
546
547
548
549
550
551
552
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
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 542

def begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_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 || status_code == 201
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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 == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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_or_update_with_http_info(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates or updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroup)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



523
524
525
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 523

def begin_create_or_update_with_http_info(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:custom_headers).value!
end

#begin_delete(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Object

Deletes a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that



629
630
631
632
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 629

def begin_delete(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
  nil
end

#begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Deletes a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
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
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 666

def begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_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(: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 == 202 || status_code == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?

    result
  end

  promise.execute
end

#begin_delete_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Deletes a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



648
649
650
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 648

def begin_delete_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
end

#begin_failover(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ FailoverGroup

Fails over from the current primary server to this server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



844
845
846
847
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 844

def begin_failover(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  response = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Fails over from the current primary server to this server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 881

def begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/failover'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_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(:post, 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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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_failover_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Fails over from the current primary server to this server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



863
864
865
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 863

def begin_failover_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
end

#begin_force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ FailoverGroup

Fails over from the current primary server to this server. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



952
953
954
955
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 952

def begin_force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  response = begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Concurrent::Promise

Fails over from the current primary server to this server. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 991

def begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}/forceFailoverAllowDataLoss'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_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(:post, 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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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_force_failover_allow_data_loss_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Fails over from the current primary server to this server. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



972
973
974
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 972

def begin_force_failover_allow_data_loss_with_http_info(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
end

#begin_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ FailoverGroup

Updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroupUpdate)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



727
728
729
730
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 727

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

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

Updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroupUpdate)

    The failover group parameters.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 766

def begin_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, 'parameters is nil' if parameters.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroupUpdate.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_group_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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroupUpdate)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



747
748
749
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 747

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

#create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ FailoverGroup

Creates or updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroup)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



149
150
151
152
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 149

def create_or_update(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  response = create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroup)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 168

def create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, server_name, failover_group_name, parameters, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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, server_name, failover_group_name, custom_headers: nil) ⇒ Object

Deletes a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that



198
199
200
201
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 198

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

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

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 216

def delete_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
    end

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

  promise
end

#failover(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ FailoverGroup

Fails over from the current primary server to this server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



401
402
403
404
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 401

def failover(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  response = failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#failover_async(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 419

def failover_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  # Send request
  promise = begin_failover_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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

#force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ FailoverGroup

Fails over from the current primary server to this server. This operation might result in data loss.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



452
453
454
455
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 452

def force_failover_allow_data_loss(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  response = force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ Concurrent::Promise

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 470

def force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  # Send request
  promise = begin_force_failover_allow_data_loss_async(resource_group_name, server_name, failover_group_name, custom_headers:custom_headers)

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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

#get(resource_group_name, server_name, failover_group_name, custom_headers: nil) ⇒ FailoverGroup

Gets a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



41
42
43
44
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 41

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

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

Gets a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



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
124
125
126
127
128
129
130
131
132
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 78

def get_async(resource_group_name, server_name, failover_group_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, 'failover_group_name is nil' if failover_group_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Sql/servers/{serverName}/failoverGroups/{failoverGroupName}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'failoverGroupName' => failover_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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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, server_name, failover_group_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Gets a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



60
61
62
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 60

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

#list_by_server(resource_group_name, server_name, custom_headers: nil) ⇒ Array<FailoverGroup>

Lists the failover groups in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

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

    A hash of custom headers that

Returns:

  • (Array<FailoverGroup>)

    operation results.



297
298
299
300
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 297

def list_by_server(resource_group_name, server_name, custom_headers:nil)
  first_page = list_by_server_as_lazy(resource_group_name, server_name, custom_headers:custom_headers)
  first_page.get_all_items
end

#list_by_server_as_lazy(resource_group_name, server_name, custom_headers: nil) ⇒ FailoverGroupListResult

Lists the failover groups in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

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

    A hash of custom headers that

Returns:

  • (FailoverGroupListResult)

    which provide lazy access to pages of the



1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 1151

def list_by_server_as_lazy(resource_group_name, server_name, custom_headers:nil)
  response = list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_server_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end

#list_by_server_async(resource_group_name, server_name, custom_headers: nil) ⇒ Concurrent::Promise

Lists the failover groups in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
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
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 332

def list_by_server_async(resource_group_name, server_name, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'server_name is nil' if server_name.nil?
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.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.Sql/servers/{serverName}/failoverGroups'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroupListResult.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_server_next(next_page_link, custom_headers: nil) ⇒ FailoverGroupListResult

Lists the failover groups in a server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (FailoverGroupListResult)

    operation results.



1057
1058
1059
1060
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 1057

def list_by_server_next(next_page_link, custom_headers:nil)
  response = list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_by_server_next_async(next_page_link, custom_headers: nil) ⇒ Concurrent::Promise

Lists the failover groups in a server.

to List operation. to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 1086

def list_by_server_next_async(next_page_link, custom_headers:nil)
  fail ArgumentError, 'next_page_link is nil' if next_page_link.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 = '{nextLink}'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      skip_encoding_path_params: {'nextLink' => next_page_link},
      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 MsRestAzure::AzureOperationError.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.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-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::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroupListResult.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_server_next_with_http_info(next_page_link, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the failover groups in a server.

to List operation. will be added to the HTTP request.

Parameters:

  • next_page_link (String)

    The NextLink from the previous successful call

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



1072
1073
1074
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 1072

def list_by_server_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_server_next_async(next_page_link, custom_headers:custom_headers).value!
end

#list_by_server_with_http_info(resource_group_name, server_name, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Lists the failover groups in a server.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

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

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



315
316
317
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 315

def list_by_server_with_http_info(resource_group_name, server_name, custom_headers:nil)
  list_by_server_async(resource_group_name, server_name, custom_headers:custom_headers).value!
end

#update(resource_group_name, server_name, failover_group_name, parameters, custom_headers: nil) ⇒ FailoverGroup

Updates a failover group.

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroupUpdate)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (FailoverGroup)

    operation results.



247
248
249
250
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 247

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

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

contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. group. will be added to the HTTP request.

response.

Parameters:

  • resource_group_name (String)

    The name of the resource group that

  • server_name (String)

    The name of the server containing the failover

  • failover_group_name (String)

    The name of the failover group.

  • parameters (FailoverGroupUpdate)

    The failover group parameters.

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

    A hash of custom headers that

Returns:

  • (Concurrent::Promise)

    promise which provides async access to http



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/2015-05-01-preview/generated/azure_mgmt_sql/failover_groups.rb', line 266

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

  promise = promise.then do |response|
    # Defining deserialization method.
    deserialize_method = lambda do |parsed_response|
      result_mapper = Azure::SQL::Mgmt::V2015_05_01_preview::Models::FailoverGroup.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