1.2.3 (latest) 1.1.2 1.0.5 0.4.5 0.3.3 0.2.2 0.1.7 Reference documentation and code samples for the Google Cloud Api Keys V2 Client class Key.

The representation of a key managed by the API Keys API.

Generated from protobuf message `google.api.apikeys.v2.Key`

## Namespace

Google \\ Cloud \\ ApiKeys \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. The resource name of the key. The `name` has the form: `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`. For example: `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` NOTE: Key is a global resource; hence the only supported value for location is `global`. |
| `↳ uid` | `string` Output only. Unique id in UUID4 format. |
| `↳ display_name` | `string` Human-readable display name of this key that you can modify. The maximum length is 63 characters. |
| `↳ key_string` | `string` Output only. An encrypted and signed value held by this key. This field can be accessed only through the `GetKeyString` method. |
| `↳ create_time` | `Google\Protobuf\Timestamp` Output only. A timestamp identifying the time this key was originally created. |
| `↳ update_time` | `Google\Protobuf\Timestamp` Output only. A timestamp identifying the time this key was last updated. |
| `↳ delete_time` | `Google\Protobuf\Timestamp` Output only. A timestamp when this key was deleted. If the resource is not deleted, this must be empty. |
| `↳ annotations` | `array|Google\Protobuf\Internal\MapField` Annotations is an unstructured key-value map stored with a policy that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. |
| `↳ restrictions` | `https://docs.cloud.google.com/php/docs/reference/cloud-api-keys/latest/V2.Restrictions` Key restrictions. |
| `↳ etag` | `string` Output only. A checksum computed by the server based on the current value of the Key resource. This may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding. See <https://google.aip.dev/154>. |

### getName

Output only. The resource name of the key.

The `name` has the form:
`projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
For example:
`projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
NOTE: Key is a global resource; hence the only supported value for
location is `global`.

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

### setName

Output only. The resource name of the key.

The `name` has the form:
`projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
For example:
`projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
NOTE: Key is a global resource; hence the only supported value for
location is `global`.

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

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

### getUid

Output only. Unique id in UUID4 format.

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

### setUid

Output only. Unique id in UUID4 format.

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

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

### getDisplayName

Human-readable display name of this key that you can modify.

The maximum length is 63 characters.

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

### setDisplayName

Human-readable display name of this key that you can modify.

The maximum length is 63 characters.

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

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

### getKeyString

Output only. An encrypted and signed value held by this key.

This field can be accessed only through the `GetKeyString` method.

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

### setKeyString

Output only. An encrypted and signed value held by this key.

This field can be accessed only through the `GetKeyString` method.

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

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

### getCreateTime

Output only. A timestamp identifying the time this key was originally
created.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. A timestamp identifying the time this key was originally
created.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

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

### getUpdateTime

Output only. A timestamp identifying the time this key was last
updated.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasUpdateTime

### clearUpdateTime

### setUpdateTime

Output only. A timestamp identifying the time this key was last
updated.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

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

### getDeleteTime

Output only. A timestamp when this key was deleted. If the resource is not
deleted, this must be empty.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasDeleteTime

### clearDeleteTime

### setDeleteTime

Output only. A timestamp when this key was deleted. If the resource is not
deleted, this must be empty.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

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

### getAnnotations

Annotations is an unstructured key-value map stored with a policy that
may be set by external tools to store and retrieve arbitrary metadata.

They are not queryable and should be preserved when modifying objects.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Internal\MapField` |   |

### setAnnotations

Annotations is an unstructured key-value map stored with a policy that
may be set by external tools to store and retrieve arbitrary metadata.

They are not queryable and should be preserved when modifying objects.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|Google\Protobuf\Internal\MapField` |

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

### getRestrictions

Key restrictions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-api-keys/latest/V2.Restrictions|null` |   |

### hasRestrictions

### clearRestrictions

### setRestrictions

Key restrictions.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-api-keys/latest/V2.Restrictions` |

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

### getEtag

Output only. A checksum computed by the server based on the current value
of the Key resource. This may be sent on update and delete requests to
ensure the client has an up-to-date value before proceeding. See
<https://google.aip.dev/154>.

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

### setEtag

Output only. A checksum computed by the server based on the current value
of the Key resource. This may be sent on update and delete requests to
ensure the client has an up-to-date value before proceeding. See
<https://google.aip.dev/154>.

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

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