class Azure::SQL::Mgmt::V2017_10_01_preview::TdeCertificates

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 TdeCertificates class. @param client service class for accessing basic functionality.

# File lib/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 20
def initialize(client)
  @client = client
end

Private Instance Methods

begin_create(resource_group_name, server_name, parameters, custom_headers:nil) click to toggle source

Creates a TDE certificate for a given server.

@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 parameters [TdeCertificate] The requested TDE certificate to be created or updated. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 86
def begin_create(resource_group_name, server_name, parameters, custom_headers:nil)
  response = begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  nil
end
begin_create_async(resource_group_name, server_name, parameters, custom_headers:nil) click to toggle source

Creates a TDE certificate for a given server.

@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 parameters [TdeCertificate] The requested TDE certificate to be created or updated. @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/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 123
def begin_create_async(resource_group_name, server_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, '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::V2017_10_01_preview::Models::TdeCertificate.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}/tdeCertificates'

  request_url = @base_url || @client.base_url

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'resourceGroupName' => resource_group_name,'serverName' => server_name,'subscriptionId' => @client.subscription_id},
      query_params: {'api-version' => @client.api_version},
      body: request_content,
      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_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil) click to toggle source

Creates a TDE certificate for a given server.

@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 parameters [TdeCertificate] The requested TDE certificate to be created or updated. @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/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 105
def begin_create_with_http_info(resource_group_name, server_name, parameters, custom_headers:nil)
  begin_create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
end
create(resource_group_name, server_name, parameters, custom_headers:nil) click to toggle source

Creates a TDE certificate for a given server.

@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 parameters [TdeCertificate] The requested TDE certificate to be created or updated. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 39
def create(resource_group_name, server_name, parameters, custom_headers:nil)
  response = create_async(resource_group_name, server_name, parameters, custom_headers:custom_headers).value!
  nil
end
create_async(resource_group_name, server_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 parameters [TdeCertificate] The requested TDE certificate to be created or updated. @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/2017-10-01-preview/generated/azure_mgmt_sql/tde_certificates.rb, line 57
def create_async(resource_group_name, server_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, server_name, parameters, 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