Class: Azure::SQL::Mgmt::V2017_10_01_preview::ManagedInstanceTdeCertificates

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ ManagedInstanceTdeCertificates

Creates and initializes a new instance of the ManagedInstanceTdeCertificates class.



20
21
22
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 20

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientSqlManagementClient (readonly)



25
26
27
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 25

def client
  @client
end

Instance Method Details

#begin_create(resource_group_name, managed_instance_name, parameters, custom_headers: nil) ⇒ Object

Creates a TDE certificate for a given server.

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



86
87
88
89
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 86

def begin_create(resource_group_name, managed_instance_name, parameters, custom_headers:nil)
  response = begin_create_async(resource_group_name, managed_instance_name, parameters, custom_headers:custom_headers).value!
  nil
end

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

Creates a TDE certificate for a given server.

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



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 123

def begin_create_async(resource_group_name, managed_instance_name, parameters, custom_headers:nil)
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
  fail ArgumentError, 'managed_instance_name is nil' if managed_instance_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/managedInstances/{managedInstanceName}/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,'managedInstanceName' => managed_instance_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, managed_instance_name, parameters, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

Creates a TDE certificate for a given server.

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



105
106
107
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 105

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

#create(resource_group_name, managed_instance_name, parameters, custom_headers: nil) ⇒ Object

Creates a TDE certificate for a given server.

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



39
40
41
42
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 39

def create(resource_group_name, managed_instance_name, parameters, custom_headers:nil)
  response = create_async(resource_group_name, managed_instance_name, parameters, custom_headers:custom_headers).value!
  nil
end

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

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

response.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/2017-10-01-preview/generated/azure_mgmt_sql/managed_instance_tde_certificates.rb', line 57

def create_async(resource_group_name, managed_instance_name, parameters, custom_headers:nil)
  # Send request
  promise = begin_create_async(resource_group_name, managed_instance_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