# Cloud KMS V1 Client - Class KeyHandle (2.9.0)

2.9.0 (latest) 2.8.0 2.7.0 2.6.0 2.5.2 2.4.0 2.3.1 2.2.0 2.1.6 2.0.0 1.23.0 1.22.1 1.21.4 1.20.3 1.19.0 1.18.1 1.17.0 1.16.4 1.15.3 Reference documentation and code samples for the Cloud KMS V1 Client class KeyHandle.

Resource-oriented representation of a request to Cloud KMS Autokey and the
resulting provisioning of a [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey).

Generated from protobuf message `google.cloud.kms.v1.KeyHandle`

## Namespace

Google \\ Cloud \\ Kms \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. Name of the [KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) resource, e.g. `projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`. |
| `↳ kms_key` | `string` Output only. Name of a [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) that has been provisioned for Customer Managed Encryption Key (CMEK) use in the [KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) project and location for the requested resource type. The [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) project will reflect the value configured in the [AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig) on the resource project's ancestor folder at the time of the [KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) creation. If more than one ancestor folder has a configured [AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig), the nearest of these configurations is used. |
| `↳ resource_type_selector` | `string` Required. Indicates the resource type that the resulting [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) is meant to protect, e.g. `{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource types. |

### getName

Identifier. Name of the [KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle)
resource, e.g.

`projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. Name of the [KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle)
resource, e.g.

`projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getKmsKey

Output only. Name of a [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) that has
been provisioned for Customer Managed Encryption Key (CMEK) use in the
[KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) project and location for the
requested resource type. The [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey)
project will reflect the value configured in the
[AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig) on the resource
project's ancestor folder at the time of the
[KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) creation. If more than one
ancestor folder has a configured
[AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig), the nearest of these
configurations is used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setKmsKey

Output only. Name of a [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) that has
been provisioned for Customer Managed Encryption Key (CMEK) use in the
[KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) project and location for the
requested resource type. The [CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey)
project will reflect the value configured in the
[AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig) on the resource
project's ancestor folder at the time of the
[KeyHandle](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.KeyHandle) creation. If more than one
ancestor folder has a configured
[AutokeyConfig](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.AutokeyConfig), the nearest of these
configurations is used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getResourceTypeSelector

Required. Indicates the resource type that the resulting
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) is meant to protect, e.g.

`{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
types.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setResourceTypeSelector

Required. Indicates the resource type that the resulting
[CryptoKey](https://docs.cloud.google.com/php/docs/reference/cloud-kms/latest/V1.CryptoKey) is meant to protect, e.g.

`{SERVICE}.googleapis.com/{TYPE}`. See documentation for supported resource
types.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |