class Azure::SQL::Mgmt::V2015_05_01_preview::SyncGroups

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.

Attributes

client[R]

@return [SqlManagementClient] reference to the SqlManagementClient

Private Class Methods

new(client) click to toggle source

Creates and initializes a new instance of the SyncGroups class. @param client service class for accessing basic functionality.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 20
def initialize(client)
  @client = client
end

Private Instance Methods

begin_create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroup] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1098
def begin_create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  response = begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1139
def begin_create_or_update_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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::SyncGroup.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}/databases/{databaseName}/syncGroups/{syncGroupName}'

  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,'databaseName' => database_name,'syncGroupName' => sync_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::SyncGroup.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::SyncGroup.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, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1119
def begin_create_or_update_with_http_info(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  begin_create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
end
begin_delete(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Deletes a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1228
def begin_delete(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Deletes a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1267
def begin_delete_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}'

  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,'databaseName' => database_name,'syncGroupName' => sync_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, database_name, sync_group_name, custom_headers:nil) click to toggle source

Deletes a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1248
def begin_delete_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  begin_delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
begin_refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Refreshes a hub database schema.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 996
def begin_refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Refreshes a hub database schema.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1035
def begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}/refreshHubSchema'

  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,'databaseName' => database_name,'syncGroupName' => sync_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?

    result
  end

  promise.execute
end
begin_refresh_hub_schema_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Refreshes a hub database schema.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1016
def begin_refresh_hub_schema_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
begin_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroup] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1330
def begin_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  response = begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1371
def begin_update_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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::SyncGroup.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}/databases/{databaseName}/syncGroups/{syncGroupName}'

  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,'databaseName' => database_name,'syncGroupName' => sync_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::SyncGroup.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, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1351
def begin_update_with_http_info(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  begin_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
end
cancel_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Cancels a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 422
def cancel_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Cancels a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 461
def cancel_sync_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}/cancelSync'

  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,'databaseName' => database_name,'syncGroupName' => sync_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
      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
cancel_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Cancels a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 442
def cancel_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  cancel_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Creates or updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroup] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 735
def create_or_update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  response = create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 755
def create_or_update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_or_update_async(resource_group_name, server_name, database_name, sync_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::SyncGroup.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, database_name, sync_group_name, custom_headers:nil) click to toggle source

Deletes a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 786
def delete(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 805
def delete_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  # Send request
  promise = begin_delete_async(resource_group_name, server_name, database_name, sync_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
get(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroup] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 623
def get(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 662
def get_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}'

  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,'databaseName' => database_name,'syncGroupName' => sync_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::SyncGroup.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, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 643
def get_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  get_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
list_by_database(resource_group_name, server_name, database_name, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<SyncGroup>] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 889
def list_by_database(resource_group_name, server_name, database_name, custom_headers:nil)
  first_page = list_by_database_as_lazy(resource_group_name, server_name, database_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_by_database_as_lazy(resource_group_name, server_name, database_name, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroupListResult] which provide lazy access to pages of the response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1892
def list_by_database_as_lazy(resource_group_name, server_name, database_name, custom_headers:nil)
  response = list_by_database_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_by_database_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_by_database_async(resource_group_name, server_name, database_name, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 926
def list_by_database_async(resource_group_name, server_name, database_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, 'database_name is nil' if database_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}/databases/{databaseName}/syncGroups'

  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,'databaseName' => database_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::SyncGroupListResult.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_database_next(next_page_link, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroupListResult] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1716
def list_by_database_next(next_page_link, custom_headers:nil)
  response = list_by_database_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_by_database_next_async(next_page_link, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1745
def list_by_database_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::SyncGroupListResult.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_database_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1731
def list_by_database_next_with_http_info(next_page_link, custom_headers:nil)
  list_by_database_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_by_database_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil) click to toggle source

Lists sync groups under a hub database.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 908
def list_by_database_with_http_info(resource_group_name, server_name, database_name, custom_headers:nil)
  list_by_database_async(resource_group_name, server_name, database_name, custom_headers:custom_headers).value!
end
list_hub_schemas(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<SyncFullSchemaProperties>] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 183
def list_hub_schemas(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  first_page = list_hub_schemas_as_lazy(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_hub_schemas_as_lazy(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncFullSchemaPropertiesListResult] which provide lazy access to pages of the response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1834
def list_hub_schemas_as_lazy(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_hub_schemas_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 222
def list_hub_schemas_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}/hubSchemas'

  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,'databaseName' => database_name,'syncGroupName' => sync_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::SyncFullSchemaPropertiesListResult.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_hub_schemas_next(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncFullSchemaPropertiesListResult] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1536
def list_hub_schemas_next(next_page_link, custom_headers:nil)
  response = list_hub_schemas_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_hub_schemas_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1565
def list_hub_schemas_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::SyncFullSchemaPropertiesListResult.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_hub_schemas_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1551
def list_hub_schemas_next_with_http_info(next_page_link, custom_headers:nil)
  list_hub_schemas_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_hub_schemas_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Gets a collection of hub database schemas.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 203
def list_hub_schemas_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  list_hub_schemas_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
list_logs(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param start_time [String] Get logs generated after this time. @param end_time [String] Get logs generated before this time. @param type [Enum] The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' @param continuation_token [String] The continuation token for this operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<SyncGroupLogProperties>] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 299
def list_logs(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil)
  first_page = list_logs_as_lazy(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:continuation_token, custom_headers:custom_headers)
  first_page.get_all_items
end
list_logs_as_lazy(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param start_time [String] Get logs generated after this time. @param end_time [String] Get logs generated before this time. @param type [Enum] The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' @param continuation_token [String] The continuation token for this operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroupLogListResult] which provide lazy access to pages of the response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1866
def list_logs_as_lazy(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil)
  response = list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:continuation_token, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_logs_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param start_time [String] Get logs generated after this time. @param end_time [String] Get logs generated before this time. @param type [Enum] The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' @param continuation_token [String] The continuation token for this operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 348
def list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, 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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_group_name.nil?
  fail ArgumentError, 'start_time is nil' if start_time.nil?
  fail ArgumentError, 'end_time is nil' if end_time.nil?
  fail ArgumentError, 'type is nil' if type.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}/databases/{databaseName}/syncGroups/{syncGroupName}/logs'

  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,'databaseName' => database_name,'syncGroupName' => sync_group_name,'subscriptionId' => @client.subscription_id},
      query_params: {'startTime' => start_time,'endTime' => end_time,'type' => type,'continuationToken' => continuation_token,'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::SyncGroupLogListResult.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_logs_next(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroupLogListResult] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1626
def list_logs_next(next_page_link, custom_headers:nil)
  response = list_logs_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_logs_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1655
def list_logs_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::SyncGroupLogListResult.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_logs_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1641
def list_logs_next_with_http_info(next_page_link, custom_headers:nil)
  list_logs_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_logs_with_http_info(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil) click to toggle source

Gets a collection of sync group logs.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param start_time [String] Get logs generated after this time. @param end_time [String] Get logs generated before this time. @param type [Enum] The types of logs to retrieve. Possible values include: 'All', 'Error', 'Warning', 'Success' @param continuation_token [String] The continuation token for this operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 324
def list_logs_with_http_info(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:nil, custom_headers:nil)
  list_logs_async(resource_group_name, server_name, database_name, sync_group_name, start_time, end_time, type, continuation_token:continuation_token, custom_headers:custom_headers).value!
end
list_sync_database_ids(location_name, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param location_name [String] The name of the region where the resource is located. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Array<SyncDatabaseIdProperties>] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 37
def list_sync_database_ids(location_name, custom_headers:nil)
  first_page = list_sync_database_ids_as_lazy(location_name, custom_headers:custom_headers)
  first_page.get_all_items
end
list_sync_database_ids_as_lazy(location_name, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param location_name [String] The name of the region where the resource is located. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncDatabaseIdListResult] which provide lazy access to pages of the response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1807
def list_sync_database_ids_as_lazy(location_name, custom_headers:nil)
  response = list_sync_database_ids_async(location_name, custom_headers:custom_headers).value!
  unless response.nil?
    page = response.body
    page.next_method = Proc.new do |next_page_link|
      list_sync_database_ids_next_async(next_page_link, custom_headers:custom_headers)
    end
    page
  end
end
list_sync_database_ids_async(location_name, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param location_name [String] The name of the region where the resource is located. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 66
def list_sync_database_ids_async(location_name, custom_headers:nil)
  fail ArgumentError, 'location_name is nil' if location_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}/providers/Microsoft.Sql/locations/{locationName}/syncDatabaseIds'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'locationName' => location_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::SyncDatabaseIdListResult.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_sync_database_ids_next(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncDatabaseIdListResult] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1446
def list_sync_database_ids_next(next_page_link, custom_headers:nil)
  response = list_sync_database_ids_next_async(next_page_link, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
list_sync_database_ids_next_async(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1475
def list_sync_database_ids_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::SyncDatabaseIdListResult.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_sync_database_ids_next_with_http_info(next_page_link, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param next_page_link [String] The NextLink from the previous successful call to List operation. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 1461
def list_sync_database_ids_next_with_http_info(next_page_link, custom_headers:nil)
  list_sync_database_ids_next_async(next_page_link, custom_headers:custom_headers).value!
end
list_sync_database_ids_with_http_info(location_name, custom_headers:nil) click to toggle source

Gets a collection of sync database ids.

@param location_name [String] The name of the region where the resource is located. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 52
def list_sync_database_ids_with_http_info(location_name, custom_headers:nil)
  list_sync_database_ids_async(location_name, custom_headers:custom_headers).value!
end
refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Refreshes a hub database schema.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 133
def refresh_hub_schema(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 152
def refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  # Send request
  promise = begin_refresh_hub_schema_async(resource_group_name, server_name, database_name, sync_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
trigger_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Triggers a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 522
def trigger_sync(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  response = trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
  nil
end
trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Triggers a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] Promise object which holds the HTTP response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 561
def trigger_sync_async(resource_group_name, server_name, database_name, sync_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, 'database_name is nil' if database_name.nil?
  fail ArgumentError, 'sync_group_name is nil' if sync_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}/databases/{databaseName}/syncGroups/{syncGroupName}/triggerSync'

  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,'databaseName' => database_name,'syncGroupName' => sync_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
      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
trigger_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil) click to toggle source

Triggers a sync group synchronization.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [MsRestAzure::AzureOperationResponse] HTTP response information.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 542
def trigger_sync_with_http_info(resource_group_name, server_name, database_name, sync_group_name, custom_headers:nil)
  trigger_sync_async(resource_group_name, server_name, database_name, sync_group_name, custom_headers:custom_headers).value!
end
update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

Updates a sync group.

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [SyncGroup] operation results.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 837
def update(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  response = update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil) click to toggle source

@param resource_group_name [String] The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param server_name [String] The name of the server. @param database_name [String] The name of the database on which the sync group is hosted. @param sync_group_name [String] The name of the sync group. @param parameters [SyncGroup] The requested sync group resource state. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Concurrent::Promise] promise which provides async access to http response.

# File lib/2015-05-01-preview/generated/azure_mgmt_sql/sync_groups.rb, line 857
def update_async(resource_group_name, server_name, database_name, sync_group_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_update_async(resource_group_name, server_name, database_name, sync_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::SyncGroup.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