Reference documentation and code samples for the Cloud Key Management Service (KMS) V1 API class Google::Cloud::Kms::V1::Autokey::Client.
Client for the Autokey service.
Provides interfaces for using Cloud KMS Autokey to provision new CryptoKeys, ready for Customer Managed Encryption Key (CMEK) use, on-demand. To support certain client tooling, this feature is modeled around a KeyHandle resource: creating a KeyHandle in a resource project and given location triggers Cloud KMS Autokey to provision a CryptoKey in the configured key project and the same location.
Prior to use in a given resource project, UpdateAutokeyConfig should have been called on an ancestor folder, setting the key project where Cloud KMS Autokey should create new CryptoKeys. See documentation for additional prerequisites. To check what key project, if any, is currently configured on a resource project's ancestor folder, see ShowEffectiveAutokeyConfig.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the Autokey Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all Autokey clients ::Google::Cloud::Kms::V1::Autokey::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the Autokey Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#create_key_handle
def create_key_handle(request, options = nil) -> ::Gapic::Operation
def create_key_handle(parent: nil, key_handle_id: nil, key_handle: nil) -> ::Gapic::Operation
Creates a new KeyHandle, triggering the provisioning of a new CryptoKey for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting KeyHandle and CryptoKey.
def create_key_handle(request, options = nil) -> ::Gapic::Operation
create_key_handle
via a request object, either of type
CreateKeyHandleRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::CreateKeyHandleRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_key_handle(parent: nil, key_handle_id: nil, key_handle: nil) -> ::Gapic::Operation
create_key_handle
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the resource project and location to create the
KeyHandle in, e.g.
projects/{PROJECT_ID}/locations/{LOCATION}
. - key_handle_id (::String) — Optional. Id of the KeyHandle. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.
- key_handle (::Google::Cloud::Kms::V1::KeyHandle, ::Hash) — Required. KeyHandle to create.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::Autokey::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::CreateKeyHandleRequest.new # Call the create_key_handle method. result = client.create_key_handle request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#get_key_handle
def get_key_handle(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyHandle
def get_key_handle(name: nil) -> ::Google::Cloud::Kms::V1::KeyHandle
Returns the KeyHandle.
def get_key_handle(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyHandle
get_key_handle
via a request object, either of type
GetKeyHandleRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::GetKeyHandleRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_key_handle(name: nil) -> ::Google::Cloud::Kms::V1::KeyHandle
get_key_handle
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
name (::String) — Required. Name of the KeyHandle resource,
e.g.
projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}
.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Kms::V1::KeyHandle)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::Autokey::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::GetKeyHandleRequest.new # Call the get_key_handle method. result = client.get_key_handle request # The returned object is of type Google::Cloud::Kms::V1::KeyHandle. p result
#iam_policy_client
def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client
Get the associated client for mix-in of the IAMPolicy.
- (Google::Iam::V1::IAMPolicy::Client)
#initialize
def initialize() { |config| ... } -> Client
Create a new Autokey client object.
- (config) — Configure the Autokey client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Kms::V1::Autokey::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Kms::V1::Autokey::Client.new do |config| config.timeout = 10.0 end
#list_key_handles
def list_key_handles(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>
def list_key_handles(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>
Lists KeyHandles.
def list_key_handles(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>
list_key_handles
via a request object, either of type
ListKeyHandlesRequest or an equivalent Hash.
- request (::Google::Cloud::Kms::V1::ListKeyHandlesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_key_handles(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>
list_key_handles
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
parent (::String) — Required. Name of the resource project and location from which to list
KeyHandles, e.g.
projects/{PROJECT_ID}/locations/{LOCATION}
. - page_size (::Integer) — Optional. Optional limit on the number of KeyHandles to include in the response. The service may return fewer than this value. Further KeyHandles can subsequently be obtained by including the ListKeyHandlesResponse.next_page_token in a subsequent request. If unspecified, at most 100 KeyHandles will be returned.
- page_token (::String) — Optional. Optional pagination token, returned earlier via ListKeyHandlesResponse.next_page_token.
-
filter (::String) — Optional. Filter to apply when listing
KeyHandles, e.g.
resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"
.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/kms/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Kms::V1::Autokey::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Kms::V1::ListKeyHandlesRequest.new # Call the list_key_handles method. result = client.list_key_handles request # The returned object is of type Gapic::PagedEnumerable. You can iterate # over elements, and API calls will be issued to fetch pages as needed. result.each do |item| # Each element is of type ::Google::Cloud::Kms::V1::KeyHandle. p item end
#location_client
def location_client() -> Google::Cloud::Location::Locations::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#operations_client
def operations_client() -> ::Google::Cloud::Kms::V1::Autokey::Operations
Get the associated client for long-running operations.
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)