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 CreateKeyRequest.

Request message for `CreateKey` method.

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

## Namespace

Google \\ Cloud \\ ApiKeys \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ parent` | `string` Required. The project in which the API key is created. |
| `↳ key` | `https://docs.cloud.google.com/php/docs/reference/cloud-api-keys/latest/V2.Key` Required. The API key fields to set at creation time. You can configure only the `display_name`, `restrictions`, and `annotations` fields. |
| `↳ key_id` | `string` User specified key id (optional). If specified, it will become the final component of the key resource name. The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string. |

### getParent

Required. The project in which the API key is created.

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

### setParent

Required. The project in which the API key is created.

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

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

### getKey

Required. The API key fields to set at creation time.

You can configure only the `display_name`, `restrictions`, and
`annotations` fields.

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

### hasKey

### clearKey

### setKey

Required. The API key fields to set at creation time.

You can configure only the `display_name`, `restrictions`, and
`annotations` fields.

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

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

### getKeyId

User specified key id (optional). If specified, it will become the final
component of the key resource name.

The id must be unique within the project, must conform with RFC-1034,
is restricted to lower-cased letters, and has a maximum length of 63
characters. In another word, the id must match the regular
expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
The id must NOT be a UUID-like string.

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

### setKeyId

User specified key id (optional). If specified, it will become the final
component of the key resource name.

The id must be unique within the project, must conform with RFC-1034,
is restricted to lower-cased letters, and has a maximum length of 63
characters. In another word, the id must match the regular
expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
The id must NOT be a UUID-like string.

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

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

### static::build

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `string` Required. The project in which the API key is created. Please see ApiKeysClient::locationName() for help formatting this field. |
| `key` | `https://docs.cloud.google.com/php/docs/reference/cloud-api-keys/latest/V2.Key` Required. The API key fields to set at creation time. You can configure only the `display_name`, `restrictions`, and `annotations` fields. |
| `keyId` | `string` User specified key id (optional). If specified, it will become the final component of the key resource name. The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string. |

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