class OCI::KeyManagement::KmsVaultClient

API for managing and performing operations with keys and vaults. (For the API for managing secrets, see the Vault Service Secret Management API. For the API for retrieving secrets, see the Vault Service Secret Retrieval API.)

Attributes

api_client[R]

Client used to make HTTP requests. @return [OCI::ApiClient]

endpoint[R]

Fully qualified endpoint URL @return [String]

region[R]

The region, which will usually correspond to a value in {OCI::Regions::REGION_ENUM}. @return [String]

retry_config[R]

The default retry configuration to apply to all operations in this service client. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation will not perform any retries @return [OCI::Retry::RetryConfig]

Public Class Methods

new(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil) click to toggle source

Creates a new KmsVaultClient. Notes:

If a config is not specified, then the global OCI.config will be used.

This client is not thread-safe

Either a region or an endpoint must be specified.  If an endpoint is specified, it will be used instead of the
  region. A region may be specified in the config or via or the region parameter. If specified in both, then the
  region parameter will be used.

@param [Config] config A Config object. @param [String] region A region used to determine the service endpoint. This will usually

correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.

@param [String] endpoint The fully qualified endpoint URL @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then

a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
so that the instance principals signer can be provided to the client

@param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests

the details for the proxy can be provided in this parameter

@param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to

apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
will not perform any retries
# File lib/oci/key_management/kms_vault_client.rb, line 54
def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
  # If the signer is an InstancePrincipalsSecurityTokenSigner or SecurityTokenSigner and no config was supplied (they are self-sufficient signers)
  # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
  # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
  # pass it to this constructor.
  #
  # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
  # so try and load the config from the default file.
  config = OCI::Config.validate_and_build_config_with_signer(config, signer)

  signer = OCI::Signer.config_file_auth_builder(config) if signer.nil?

  @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
  @retry_config = retry_config

  if endpoint
    @endpoint = endpoint + '/'
  else
    region ||= config.region
    region ||= signer.region if signer.respond_to?(:region)
    self.region = region
  end
  logger.info "KmsVaultClient endpoint set to '#{@endpoint}'." if logger
end

Public Instance Methods

backup_vault(vault_id, opts = {}) click to toggle source

Backs up an encrypted file that contains all the metadata of a vault so that you can restore the vault later. You can backup a vault whether or not it contains keys. This operation only backs up the metadata of the vault, and does not include key metadata.

@param [String] vault_id The OCID of the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@option opts [OCI::KeyManagement::Models::BackupVaultDetails] :backup_vault_details BackupVaultDetails @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/backup_vault.rb.html) to see an example of how to use backup_vault API.

# File lib/oci/key_management/kms_vault_client.rb, line 130
def backup_vault(vault_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#backup_vault.' if logger

  raise "Missing the required parameter 'vault_id' when calling backup_vault." if vault_id.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/backup'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(opts[:backup_vault_details])

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#backup_vault') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
cancel_vault_deletion(vault_id, opts = {}) click to toggle source

Cancels the scheduled deletion of the specified vault. Canceling a scheduled deletion restores the vault and all keys in it to their respective states from before their scheduled deletion. All keys that were scheduled for deletion prior to vault deletion retain their lifecycle state and time of deletion.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/cancel_vault_deletion.rb.html) to see an example of how to use cancel_vault_deletion API.

# File lib/oci/key_management/kms_vault_client.rb, line 212
def cancel_vault_deletion(vault_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#cancel_vault_deletion.' if logger

  raise "Missing the required parameter 'vault_id' when calling cancel_vault_deletion." if vault_id.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/cancelDeletion'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#cancel_vault_deletion') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
change_vault_compartment(vault_id, change_vault_compartment_details, opts = {}) click to toggle source

Moves a vault into a different compartment within the same tenancy. For information about moving resources between compartments, see [Moving Resources to a Different Compartment](docs.cloud.oracle.com/iaas/Content/Identity/Tasks/managingcompartments.htm#moveRes).

When provided, if-match is checked against the ETag values of the resource.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [OCI::KeyManagement::Models::ChangeVaultCompartmentDetails] change_vault_compartment_details @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type nil @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/change_vault_compartment.rb.html) to see an example of how to use change_vault_compartment API.

# File lib/oci/key_management/kms_vault_client.rb, line 295
def change_vault_compartment(vault_id, change_vault_compartment_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#change_vault_compartment.' if logger

  raise "Missing the required parameter 'vault_id' when calling change_vault_compartment." if vault_id.nil?
  raise "Missing the required parameter 'change_vault_compartment_details' when calling change_vault_compartment." if change_vault_compartment_details.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/changeCompartment'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(change_vault_compartment_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#change_vault_compartment') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end
create_vault(create_vault_details, opts = {}) click to toggle source

Creates a new vault. The type of vault you create determines key placement, pricing, and available options. Options include storage isolation, a dedicated service endpoint instead of a shared service endpoint for API calls, and either a dedicated hardware security module (HSM) or a multitenant HSM.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [OCI::KeyManagement::Models::CreateVaultDetails] create_vault_details CreateVaultDetails @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/create_vault.rb.html) to see an example of how to use create_vault API.

# File lib/oci/key_management/kms_vault_client.rb, line 371
def create_vault(create_vault_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#create_vault.' if logger

  raise "Missing the required parameter 'create_vault_details' when calling create_vault." if create_vault_details.nil?

  path = '/20180608/vaults'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(create_vault_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#create_vault') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
create_vault_replica(vault_id, create_vault_replica_details, opts = {}) click to toggle source

Creates a replica for the vault in another region in the same realm

The API is a no-op if called for same region that a vault is already replicated to. 409 if called on a vault that is already replicated to a different region. Users need to delete existing replica first before calling it with a different region.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [OCI::KeyManagement::Models::CreateVaultReplicaDetails] create_vault_replica_details CreateVaultReplicaDetails @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type nil @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/create_vault_replica.rb.html) to see an example of how to use create_vault_replica API.

# File lib/oci/key_management/kms_vault_client.rb, line 453
def create_vault_replica(vault_id, create_vault_replica_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#create_vault_replica.' if logger

  raise "Missing the required parameter 'vault_id' when calling create_vault_replica." if vault_id.nil?
  raise "Missing the required parameter 'create_vault_replica_details' when calling create_vault_replica." if create_vault_replica_details.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/createReplica'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(create_vault_replica_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#create_vault_replica') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end
delete_vault_replica(vault_id, delete_vault_replica_details, opts = {}) click to toggle source

Deletes a vault replica

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [OCI::KeyManagement::Models::DeleteVaultReplicaDetails] delete_vault_replica_details DeleteVaultReplicaDetails @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type nil @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/delete_vault_replica.rb.html) to see an example of how to use delete_vault_replica API.

# File lib/oci/key_management/kms_vault_client.rb, line 533
def delete_vault_replica(vault_id, delete_vault_replica_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#delete_vault_replica.' if logger

  raise "Missing the required parameter 'vault_id' when calling delete_vault_replica." if vault_id.nil?
  raise "Missing the required parameter 'delete_vault_replica_details' when calling delete_vault_replica." if delete_vault_replica_details.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/deleteReplica'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(delete_vault_replica_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#delete_vault_replica') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body
    )
  end
  # rubocop:enable Metrics/BlockLength
end
get_vault(vault_id, opts = {}) click to toggle source

Gets the specified vault's configuration information.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning read operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning read operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/get_vault.rb.html) to see an example of how to use get_vault API.

# File lib/oci/key_management/kms_vault_client.rb, line 599
def get_vault(vault_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#get_vault.' if logger

  raise "Missing the required parameter 'vault_id' when calling get_vault." if vault_id.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#get_vault') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
get_vault_usage(vault_id, opts = {}) click to toggle source

Gets the count of keys and key versions in the specified vault to calculate usage against service limits.

@param [String] vault_id The OCID of the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::VaultUsage VaultUsage} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/get_vault_usage.rb.html) to see an example of how to use get_vault_usage API.

# File lib/oci/key_management/kms_vault_client.rb, line 657
def get_vault_usage(vault_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#get_vault_usage.' if logger

  raise "Missing the required parameter 'vault_id' when calling get_vault_usage." if vault_id.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/usage'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#get_vault_usage') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::VaultUsage'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
list_vault_replicas(vault_id, opts = {}) click to toggle source

Lists the replicas for a vault

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [Integer] :limit The maximum number of items to return in a paginated "List" call.

@option opts [String] :page The value of the `opc-next-page` response header

from the previous \"List\" call.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default

order for `TIMECREATED` is descending. The default order for `DISPLAYNAME`
is ascending.

Allowed values are: TIMECREATED, DISPLAYNAME

@option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).

Allowed values are: ASC, DESC

@return [Response] A Response object with data of type Array<{OCI::KeyManagement::Models::VaultReplicaSummary VaultReplicaSummary}> @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/list_vault_replicas.rb.html) to see an example of how to use list_vault_replicas API.

# File lib/oci/key_management/kms_vault_client.rb, line 746
def list_vault_replicas(vault_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#list_vault_replicas.' if logger

  raise "Missing the required parameter 'vault_id' when calling list_vault_replicas." if vault_id.nil?

  if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
  end

  if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/listReplicas'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#list_vault_replicas') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::KeyManagement::Models::VaultReplicaSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
list_vaults(compartment_id, opts = {}) click to toggle source

Lists the vaults in the specified compartment.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning read operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning read operations exceeds 10 requests per second for a given tenancy.

@param [String] compartment_id The OCID of the compartment. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [Integer] :limit The maximum number of items to return in a paginated "List" call.

@option opts [String] :page The value of the `opc-next-page` response header

from the previous \"List\" call.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :sort_by The field to sort by. You can specify only one sort order. The default

order for `TIMECREATED` is descending. The default order for `DISPLAYNAME`
is ascending.

Allowed values are: TIMECREATED, DISPLAYNAME

@option opts [String] :sort_order The sort order to use, either ascending (`ASC`) or descending (`DESC`).

Allowed values are: ASC, DESC

@return [Response] A Response object with data of type Array<{OCI::KeyManagement::Models::VaultSummary VaultSummary}> @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/list_vaults.rb.html) to see an example of how to use list_vaults API.

# File lib/oci/key_management/kms_vault_client.rb, line 837
def list_vaults(compartment_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#list_vaults.' if logger

  raise "Missing the required parameter 'compartment_id' when calling list_vaults." if compartment_id.nil?

  if opts[:sort_by] && !%w[TIMECREATED DISPLAYNAME].include?(opts[:sort_by])
    raise 'Invalid value for "sort_by", must be one of TIMECREATED, DISPLAYNAME.'
  end

  if opts[:sort_order] && !%w[ASC DESC].include?(opts[:sort_order])
    raise 'Invalid value for "sort_order", must be one of ASC, DESC.'
  end

  path = '/20180608/vaults'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id
  query_params[:limit] = opts[:limit] if opts[:limit]
  query_params[:page] = opts[:page] if opts[:page]
  query_params[:sortBy] = opts[:sort_by] if opts[:sort_by]
  query_params[:sortOrder] = opts[:sort_order] if opts[:sort_order]

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = nil

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#list_vaults') do
    @api_client.call_api(
      :GET,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'Array<OCI::KeyManagement::Models::VaultSummary>'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
logger() click to toggle source

@return [Logger] The logger for this client. May be nil.

# File lib/oci/key_management/kms_vault_client.rb, line 93
def logger
  @api_client.config.logger
end
region=(new_region) click to toggle source

Set the region that will be used to determine the service endpoint. This will usually correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.

# File lib/oci/key_management/kms_vault_client.rb, line 83
def region=(new_region)
  @region = new_region

  raise 'A region must be specified.' unless @region

  @endpoint = OCI::Regions.get_service_endpoint_for_template(@region, 'https://kms.{region}.{secondLevelDomain}') + '/'
  logger.info "KmsVaultClient endpoint set to '#{@endpoint} from region #{@region}'." if logger
end
restore_vault_from_file(compartment_id, restore_vault_from_file_details, opts = {}) click to toggle source

Restores a vault from an encrypted backup file. If a vault with the same OCID already exists, this operation returns a response with a 409 HTTP status error code.

@param [String] compartment_id The OCID of the compartment. @param [String, IO] restore_vault_from_file_details The encrypted backup file to upload to restore the vault. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [Integer] :content_length The content length of the body. @option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :content_md5 The base64-encoded MD5 hash value of the body, as described in [RFC 2616](tools.ietf.org/rfc/rfc2616), section 14.15.

If the Content-MD5 header is present, Key Management performs an integrity check on the body of the HTTP request by computing the MD5
hash for the body and comparing it to the MD5 hash supplied in the header. If the two hashes don't match, the object is rejected and
a response with 400 Unmatched Content MD5 error is returned, along with the message: \"The computed MD5 of the request body (ACTUAL_MD5)
does not match the Content-MD5 header (HEADER_MD5).\"

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/restore_vault_from_file.rb.html) to see an example of how to use restore_vault_from_file API.

# File lib/oci/key_management/kms_vault_client.rb, line 930
def restore_vault_from_file(compartment_id, restore_vault_from_file_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#restore_vault_from_file.' if logger

  raise "Missing the required parameter 'compartment_id' when calling restore_vault_from_file." if compartment_id.nil?
  raise "Missing the required parameter 'restore_vault_from_file_details' when calling restore_vault_from_file." if restore_vault_from_file_details.nil?

  path = '/20180608/vaults/actions/restoreFromFile'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-length'] = opts[:content_length] if opts[:content_length]
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'content-md5'] = opts[:content_md5] if opts[:content_md5]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'content-type'] ||= 'application/octet-stream'
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(restore_vault_from_file_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#restore_vault_from_file') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
restore_vault_from_object_store(compartment_id, opts = {}) click to toggle source

Restores a vault from an encrypted backup file stored in Oracle Cloud Infrastructure Object Storage. If a vault with the same OCID already exists, this operation returns a response with a 409 HTTP status error code.

@param [String] compartment_id The OCID of the compartment. @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@option opts [OCI::KeyManagement::Models::RestoreVaultFromObjectStoreDetails] :restore_vault_from_object_store_details RestoreVaultFromObjectStoreDetails @return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/restore_vault_from_object_store.rb.html) to see an example of how to use restore_vault_from_object_store API.

# File lib/oci/key_management/kms_vault_client.rb, line 1010
def restore_vault_from_object_store(compartment_id, opts = {})
  logger.debug 'Calling operation KmsVaultClient#restore_vault_from_object_store.' if logger

  raise "Missing the required parameter 'compartment_id' when calling restore_vault_from_object_store." if compartment_id.nil?

  path = '/20180608/vaults/actions/restoreFromObjectStore'
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}
  query_params[:compartmentId] = compartment_id

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(opts[:restore_vault_from_object_store_details])

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#restore_vault_from_object_store') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
schedule_vault_deletion(vault_id, schedule_vault_deletion_details, opts = {}) click to toggle source

Schedules the deletion of the specified vault. This sets the lifecycle state of the vault and all keys in it that are not already scheduled for deletion to `PENDING_DELETION` and then deletes them after the retention period ends. The lifecycle state and time of deletion for keys already scheduled for deletion won't change. If any keys in the vault are scheduled to be deleted after the specified time of deletion for the vault, the call is rejected with the error code 409.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [OCI::KeyManagement::Models::ScheduleVaultDeletionDetails] schedule_vault_deletion_details ScheduleVaultDeletionDetails @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@option opts [String] :opc_retry_token A token that uniquely identifies a request so it can be retried in case

of a timeout or server error without risk of executing that same action
again. Retry tokens expire after 24 hours, but can be invalidated
before then due to conflicting operations (e.g., if a resource has been
deleted and purged from the system, then a retry of the original
creation request may be rejected).

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/schedule_vault_deletion.rb.html) to see an example of how to use schedule_vault_deletion API.

# File lib/oci/key_management/kms_vault_client.rb, line 1094
def schedule_vault_deletion(vault_id, schedule_vault_deletion_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#schedule_vault_deletion.' if logger

  raise "Missing the required parameter 'vault_id' when calling schedule_vault_deletion." if vault_id.nil?
  raise "Missing the required parameter 'schedule_vault_deletion_details' when calling schedule_vault_deletion." if schedule_vault_deletion_details.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}/actions/scheduleDeletion'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  header_params[:'opc-retry-token'] = opts[:opc_retry_token] if opts[:opc_retry_token]
  # rubocop:enable Style/NegatedIf
  header_params[:'opc-retry-token'] ||= OCI::Retry.generate_opc_retry_token

  post_body = @api_client.object_to_http_body(schedule_vault_deletion_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#schedule_vault_deletion') do
    @api_client.call_api(
      :POST,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end
update_vault(vault_id, update_vault_details, opts = {}) click to toggle source

Updates the properties of a vault. Specifically, you can update the `displayName`, `freeformTags`, and `definedTags` properties. Furthermore, the vault must be in an ACTIVE or CREATING state to be updated.

As a provisioning operation, this call is subject to a Key Management limit that applies to the total number of requests across all provisioning write operations. Key Management might throttle this call to reject an otherwise valid request when the total rate of provisioning write operations exceeds 10 requests per second for a given tenancy.

@param [String] vault_id The OCID of the vault. @param [OCI::KeyManagement::Models::UpdateVaultDetails] update_vault_details UpdateVaultDetails @param [Hash] opts the optional parameters @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level

retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry

@option opts [String] :if_match For optimistic concurrency control. In the PUT or DELETE call for a

resource, set the `if-match` parameter to the value of the etag from a
previous GET or POST response for that resource. The resource will be
updated or deleted only if the etag you provide matches the resource's
current etag value.

@option opts [String] :opc_request_id Unique identifier for the request. If provided, the returned request ID

will include this value. Otherwise, a random request ID will be
generated by the service.

@return [Response] A Response object with data of type {OCI::KeyManagement::Models::Vault Vault} @note Click [here](docs.cloud.oracle.com/en-us/iaas/tools/ruby-sdk-examples/latest/keymanagement/update_vault.rb.html) to see an example of how to use update_vault API.

# File lib/oci/key_management/kms_vault_client.rb, line 1170
def update_vault(vault_id, update_vault_details, opts = {})
  logger.debug 'Calling operation KmsVaultClient#update_vault.' if logger

  raise "Missing the required parameter 'vault_id' when calling update_vault." if vault_id.nil?
  raise "Missing the required parameter 'update_vault_details' when calling update_vault." if update_vault_details.nil?
  raise "Parameter value for 'vault_id' must not be blank" if OCI::Internal::Util.blank_string?(vault_id)

  path = '/20180608/vaults/{vaultId}'.sub('{vaultId}', vault_id.to_s)
  operation_signing_strategy = :standard

  # rubocop:disable Style/NegatedIf
  # Query Params
  query_params = {}

  # Header Params
  header_params = {}
  header_params[:accept] = 'application/json'
  header_params[:'content-type'] = 'application/json'
  header_params[:'if-match'] = opts[:if_match] if opts[:if_match]
  header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
  # rubocop:enable Style/NegatedIf

  post_body = @api_client.object_to_http_body(update_vault_details)

  # rubocop:disable Metrics/BlockLength
  OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'KmsVaultClient#update_vault') do
    @api_client.call_api(
      :PUT,
      path,
      endpoint,
      header_params: header_params,
      query_params: query_params,
      operation_signing_strategy: operation_signing_strategy,
      body: post_body,
      return_type: 'OCI::KeyManagement::Models::Vault'
    )
  end
  # rubocop:enable Metrics/BlockLength
end

Private Instance Methods

applicable_retry_config(opts = {}) click to toggle source

rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists rubocop:enable Metrics/MethodLength, Layout/EmptyLines

# File lib/oci/key_management/kms_vault_client.rb, line 1215
def applicable_retry_config(opts = {})
  return @retry_config unless opts.key?(:retry_config)

  opts[:retry_config]
end