# Interface KeyOrBuilder (0.89.0)

0.89.0 (latest) 0.86.0 0.85.0 0.83.0 0.81.0 0.80.0 0.79.0 0.78.0 0.76.0 0.74.0 0.73.0 0.72.0 0.71.0 0.70.0 0.68.0 0.66.0 0.65.0 0.62.0 0.61.0 0.60.0 0.58.0 0.57.0 0.56.0 0.55.0 0.54.0 0.53.0 0.52.0 0.51.0 0.50.0 0.49.0 0.47.0 0.46.0 0.45.0 0.44.0 0.43.0 0.42.0 0.41.0 0.40.0 0.39.0 0.38.0 0.37.0 0.35.0 0.34.0 0.33.0 0.32.0 0.31.0 0.30.0 0.29.0 0.28.0 0.27.0 0.26.0 0.25.0 0.22.0 0.21.0 0.20.0 0.19.0 0.18.0 0.17.0 0.16.0 0.15.0 0.14.0 0.13.0 0.12.0 0.11.0 0.10.0 0.9.0 0.8.0 0.7.0 0.6.0 0.5.0 0.4.0 0.3.0 0.2.0 0.1.2

    public interface KeyOrBuilder extends MessageOrBuilder

## Implements

[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)

## Methods

### containsAnnotations(String key)

    public abstract boolean containsAnnotations(String key)

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.

`map<string, string> annotations = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getAnnotations() (deprecated)

    public abstract Map<String,String> getAnnotations()

Use [#getAnnotationsMap()](https://docs.cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.google.api.apikeys.v2.KeyOrBuilder#com_google_api_apikeys_v2_KeyOrBuilder_getAnnotationsMap__) instead.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getAnnotationsCount()

    public abstract int getAnnotationsCount()

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.

`map<string, string> annotations = 8;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### getAnnotationsMap()

    public abstract Map<String,String> getAnnotationsMap()

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.

`map<string, string> annotations = 8;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/util/Map.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html,https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |   |

### getAnnotationsOrDefault(String key, String defaultValue)

    public abstract String getAnnotationsOrDefault(String key, String defaultValue)

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.

`map<string, string> annotations = 8;`

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `defaultValue` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getAnnotationsOrThrow(String key)

    public abstract String getAnnotationsOrThrow(String key)

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.

`map<string, string> annotations = 8;`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `key` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getCreateTime()

    public abstract Timestamp getCreateTime()

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

`.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` | The createTime. |

### getCreateTimeOrBuilder()

    public abstract TimestampOrBuilder getCreateTimeOrBuilder()

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

`.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TimestampOrBuilder.html` |   |

### getDeleteTime()

    public abstract Timestamp getDeleteTime()

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

`.google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` | The deleteTime. |

### getDeleteTimeOrBuilder()

    public abstract TimestampOrBuilder getDeleteTimeOrBuilder()

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

`.google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TimestampOrBuilder.html` |   |

### getDisplayName()

    public abstract String getDisplayName()

Human-readable display name of this key that you can modify.
The maximum length is 63 characters.

`string display_name = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The displayName. |

### getDisplayNameBytes()

    public abstract ByteString getDisplayNameBytes()

Human-readable display name of this key that you can modify.
The maximum length is 63 characters.

`string display_name = 2;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for displayName. |

### getEtag()

    public abstract String 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>.

`string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The etag. |

### getEtagBytes()

    public abstract ByteString getEtagBytes()

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

`string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for etag. |

### getKeyString()

    public abstract String getKeyString()

Output only. An encrypted and signed value held by this key.
This field can be accessed only through the `GetKeyString` method.

`string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The keyString. |

### getKeyStringBytes()

    public abstract ByteString getKeyStringBytes()

Output only. An encrypted and signed value held by this key.
This field can be accessed only through the `GetKeyString` method.

`string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for keyString. |

### getName()

    public abstract String 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`.

`string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The name. |

### getNameBytes()

    public abstract ByteString getNameBytes()

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

`string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for name. |

### getRestrictions()

    public abstract Restrictions getRestrictions()

Key restrictions.

`.google.api.apikeys.v2.Restrictions restrictions = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.google.api.apikeys.v2.Restrictions` | The restrictions. |

### getRestrictionsOrBuilder()

    public abstract RestrictionsOrBuilder getRestrictionsOrBuilder()

Key restrictions.

`.google.api.apikeys.v2.Restrictions restrictions = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/com.google.api.apikeys.v2.RestrictionsOrBuilder` |   |

### getUid()

    public abstract String getUid()

Output only. Unique id in UUID4 format.

`string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` | The uid. |

### getUidBytes()

    public abstract ByteString getUidBytes()

Output only. Unique id in UUID4 format.

`string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.ByteString.html` | The bytes for uid. |

### getUpdateTime()

    public abstract Timestamp getUpdateTime()

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

`.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.Timestamp.html` | The updateTime. |

### getUpdateTimeOrBuilder()

    public abstract TimestampOrBuilder getUpdateTimeOrBuilder()

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

`.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.TimestampOrBuilder.html` |   |

### hasCreateTime()

    public abstract boolean hasCreateTime()

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

`.google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the createTime field is set. |

### hasDeleteTime()

    public abstract boolean hasDeleteTime()

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

`.google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the deleteTime field is set. |

### hasRestrictions()

    public abstract boolean hasRestrictions()

Key restrictions.

`.google.api.apikeys.v2.Restrictions restrictions = 9;`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the restrictions field is set. |

### hasUpdateTime()

    public abstract boolean hasUpdateTime()

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

`.google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY];
`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` | Whether the updateTime field is set. |