# Cloud Key Management Service (KMS) V1 API - Class Google::Cloud::Kms::V1::Autokey::Rest::Client (v1.13.0)

1.13.0 (latest) 1.12.1 1.11.0 1.10.0 1.9.2 1.8.0 1.7.0 1.6.0 1.5.1 1.4.0 1.3.2 1.2.1 1.1.0 1.0.2 0.27.0 0.26.0 0.25.1 0.24.3 0.23.0 0.22.1 0.21.0 0.20.0 0.19.0 0.18.1 0.17.0 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.2 Reference documentation and code samples for the Cloud Key Management Service (KMS) V1 API class Google::Cloud::Kms::V1::Autokey::Rest::Client.

REST client for the Autokey service.


Provides interfaces for using [Cloud KMS
Autokey](https://cloud.google.com/kms/help/autokey) to provision new
[CryptoKeys](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CryptoKey "Google::Cloud::Kms::V1::CryptoKey (class)"), ready for Customer Managed
Encryption Key (CMEK) use, on-demand. To support certain client tooling, this
feature is modeled around a [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)")
resource: creating a [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") in a resource
project and given location triggers Cloud KMS Autokey to provision a
[CryptoKey](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CryptoKey "Google::Cloud::Kms::V1::CryptoKey (class)") in the configured key project and
the same location.

<br />

Prior to use in a given resource project,
[UpdateAutokeyConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-AutokeyAdmin-Rest-Client#Google__Cloud__Kms__V1__AutokeyAdmin__Rest__Client_update_autokey_config_instance_ "Google::Cloud::Kms::V1::AutokeyAdmin::Rest::Client#update_autokey_config (method)")
should have been called on an ancestor folder, setting the key project where
Cloud KMS Autokey should create new
[CryptoKeys](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CryptoKey "Google::Cloud::Kms::V1::CryptoKey (class)"). See documentation for additional
prerequisites. To check what key project, if any, is currently configured on
a resource project's ancestor folder, see
[ShowEffectiveAutokeyConfig](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-AutokeyAdmin-Rest-Client#Google__Cloud__Kms__V1__AutokeyAdmin__Rest__Client_show_effective_autokey_config_instance_ "Google::Cloud::Kms::V1::AutokeyAdmin::Rest::Client#show_effective_autokey_config (method)").

## Inherits

- Object

## Includes

- [Google::Cloud::Kms::V1::Autokey::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Paths)

## Methods

### .configure

    def self.configure() { |config| ... } -> Client::Configuration

Configure the Autokey Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration "Google::Cloud::Kms::V1::Autokey::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all Autokey clients
::Google::Cloud::Kms::V1::Autokey::Rest::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client#Google__Cloud__Kms__V1__Autokey__Rest__Client_configure_class_ "Google::Cloud::Kms::V1::Autokey::Rest::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration "Google::Cloud::Kms::V1::Autokey::Rest::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)"), triggering the
provisioning of a new [CryptoKey](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CryptoKey "Google::Cloud::Kms::V1::CryptoKey (class)") for CMEK
use with the given resource type in the configured key project and the same
location. GetOperation should
be used to resolve the resulting long-running operation and get the
resulting [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") and
[CryptoKey](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CryptoKey "Google::Cloud::Kms::V1::CryptoKey (class)").
**Overloads**

    def create_key_handle(request, options = nil) -> ::Gapic::Operation

Pass arguments to `create_key_handle` via a request object, either of type [CreateKeyHandleRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-CreateKeyHandleRequest "Google::Cloud::Kms::V1::CreateKeyHandleRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Kms::V1::CreateKeyHandleRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/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

Pass arguments to `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). **Parameters**

- **parent** (::String) --- Required. Name of the resource project and location to create the [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") in, e.g. `projects/{PROJECT_ID}/locations/{LOCATION}`.
- **key_handle_id** (::String) --- Optional. Id of the [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)"). 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle), ::Hash) --- Required. [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") to create.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Operation)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Operation)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/kms/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Kms::V1::Autokey::Rest::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)").
**Overloads**

    def get_key_handle(request, options = nil) -> ::Google::Cloud::Kms::V1::KeyHandle

Pass arguments to `get_key_handle` via a request object, either of type [GetKeyHandleRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-GetKeyHandleRequest "Google::Cloud::Kms::V1::GetKeyHandleRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Kms::V1::GetKeyHandleRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/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

Pass arguments to `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). **Parameter**

- **name** (::String) --- Required. Name of the [KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") resource, e.g. `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** ([::Google::Cloud::Kms::V1::KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle))
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- ([::Google::Cloud::Kms::V1::KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle))
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/kms/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Kms::V1::Autokey::Rest::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::Rest::Client

Get the associated client for mix-in of the IAMPolicy.
**Returns**

- (Google::Iam::V1::IAMPolicy::Rest::Client)

### #initialize

    def initialize() { |config| ... } -> Client

Create a new Autokey REST client object.
**Yields**

- (config) --- Configure the Autokey client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::Kms::V1::Autokey::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Kms::V1::Autokey::Rest::Client.new do |config|
  config.timeout = 10.0
end
```

### #list_key_handles

    def list_key_handles(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>
    def list_key_handles(parent: nil, page_size: nil, page_token: nil, filter: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>

Lists [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)").
**Overloads**

    def list_key_handles(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>

Pass arguments to `list_key_handles` via a request object, either of type [ListKeyHandlesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-ListKeyHandlesRequest "Google::Cloud::Kms::V1::ListKeyHandlesRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::Kms::V1::ListKeyHandlesRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/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::Rest::PagedEnumerable<::Google::Cloud::Kms::V1::KeyHandle>

Pass arguments to `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). **Parameters**

- **parent** (::String) --- Required. Name of the resource project and location from which to list [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)"), e.g. `projects/{PROJECT_ID}/locations/{LOCATION}`.
- **page_size** (::Integer) --- Optional. Optional limit on the number of [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") to include in the response. The service may return fewer than this value. Further [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") can subsequently be obtained by including the [ListKeyHandlesResponse.next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-ListKeyHandlesResponse#Google__Cloud__Kms__V1__ListKeyHandlesResponse_next_page_token_instance_ "Google::Cloud::Kms::V1::ListKeyHandlesResponse#next_page_token (method)") in a subsequent request. If unspecified, at most 100 [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)") will be returned.
- **page_token** (::String) --- Optional. Optional pagination token, returned earlier via [ListKeyHandlesResponse.next_page_token](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-ListKeyHandlesResponse#Google__Cloud__Kms__V1__ListKeyHandlesResponse_next_page_token_instance_ "Google::Cloud::Kms::V1::ListKeyHandlesResponse#next_page_token (method)").
- **filter** (::String) --- Optional. Filter to apply when listing [KeyHandles](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle "Google::Cloud::Kms::V1::KeyHandle (class)"), e.g. `resource_type_selector="{SERVICE}.googleapis.com/{TYPE}"`.
**Yields**

- (result, operation) --- Access the result along with the TransportOperation object
**Yield Parameters**

- **result** (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::Kms::V1::KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle)\>)
- **operation** (::Gapic::Rest::TransportOperation)
**Returns**

- (::Gapic::Rest::PagedEnumerable\<[::Google::Cloud::Kms::V1::KeyHandle](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-KeyHandle)\>)
**Raises**

- (::Google::Cloud::Error) --- if the REST call is aborted.
**Example**

Basic example

```ruby
require "google/cloud/kms/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Kms::V1::Autokey::Rest::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::Rest::Client

Get the associated client for mix-in of the Locations.
**Returns**

- (Google::Cloud::Location::Locations::Rest::Client)

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #operations_client

    def operations_client() -> ::Google::Cloud::Kms::V1::Autokey::Rest::Operations

Get the associated client for long-running operations.
**Returns**

- ([::Google::Cloud::Kms::V1::Autokey::Rest::Operations](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-kms-v1/latest/Google-Cloud-Kms-V1-Autokey-Rest-Operations))

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)