Class CryptoKey.Builder (2.57.0)

public static final class CryptoKey.Builder extends GeneratedMessageV3.Builder<CryptoKey.Builder> implements CryptoKeyOrBuilder

A CryptoKey represents a logical key that can be used for cryptographic operations.

A CryptoKey is made up of zero or more versions, which represent the actual key material used in cryptographic operations.

Protobuf type google.cloud.kms.v1.CryptoKey

Implements

CryptoKeyOrBuilder

Static Methods

getDescriptor()

public static final Descriptors.Descriptor getDescriptor()
Returns
Type Description
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public CryptoKey.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
CryptoKey.Builder
Overrides

build()

public CryptoKey build()
Returns
Type Description
CryptoKey

buildPartial()

public CryptoKey buildPartial()
Returns
Type Description
CryptoKey

clear()

public CryptoKey.Builder clear()
Returns
Type Description
CryptoKey.Builder
Overrides

clearCreateTime()

public CryptoKey.Builder clearCreateTime()

Output only. The time at which this CryptoKey was created.

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

Returns
Type Description
CryptoKey.Builder

clearCryptoKeyBackend()

public CryptoKey.Builder clearCryptoKeyBackend()

Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/*. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future.

string crypto_key_backend = 15 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

clearDestroyScheduledDuration()

public CryptoKey.Builder clearDestroyScheduledDuration()

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
CryptoKey.Builder

clearField(Descriptors.FieldDescriptor field)

public CryptoKey.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
Name Description
field FieldDescriptor
Returns
Type Description
CryptoKey.Builder
Overrides

clearImportOnly()

public CryptoKey.Builder clearImportOnly()

Immutable. Whether this key may contain imported versions only.

bool import_only = 13 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

clearKeyAccessJustificationsPolicy()

public CryptoKey.Builder clearKeyAccessJustificationsPolicy()

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
CryptoKey.Builder

clearLabels()

public CryptoKey.Builder clearLabels()
Returns
Type Description
CryptoKey.Builder

clearName()

public CryptoKey.Builder clearName()

Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

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

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

clearNextRotationTime()

public CryptoKey.Builder clearNextRotationTime()

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Returns
Type Description
CryptoKey.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public CryptoKey.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
Name Description
oneof OneofDescriptor
Returns
Type Description
CryptoKey.Builder
Overrides

clearPrimary()

public CryptoKey.Builder clearPrimary()

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CryptoKey.Builder

clearPurpose()

public CryptoKey.Builder clearPurpose()

Immutable. The immutable purpose of this CryptoKey.

.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

clearRotationPeriod()

public CryptoKey.Builder clearRotationPeriod()

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Returns
Type Description
CryptoKey.Builder

clearRotationSchedule()

public CryptoKey.Builder clearRotationSchedule()
Returns
Type Description
CryptoKey.Builder

clearVersionTemplate()

public CryptoKey.Builder clearVersionTemplate()

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Returns
Type Description
CryptoKey.Builder

clone()

public CryptoKey.Builder clone()
Returns
Type Description
CryptoKey.Builder
Overrides

containsLabels(String key)

public boolean containsLabels(String key)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameter
Name Description
key String
Returns
Type Description
boolean

getCreateTime()

public Timestamp getCreateTime()

Output only. The time at which this CryptoKey was created.

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

Returns
Type Description
Timestamp

The createTime.

getCreateTimeBuilder()

public Timestamp.Builder getCreateTimeBuilder()

Output only. The time at which this CryptoKey was created.

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

Returns
Type Description
Builder

getCreateTimeOrBuilder()

public TimestampOrBuilder getCreateTimeOrBuilder()

Output only. The time at which this CryptoKey was created.

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

Returns
Type Description
TimestampOrBuilder

getCryptoKeyBackend()

public String getCryptoKeyBackend()

Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/*. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future.

string crypto_key_backend = 15 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }

Returns
Type Description
String

The cryptoKeyBackend.

getCryptoKeyBackendBytes()

public ByteString getCryptoKeyBackendBytes()

Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/*. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future.

string crypto_key_backend = 15 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }

Returns
Type Description
ByteString

The bytes for cryptoKeyBackend.

getDefaultInstanceForType()

public CryptoKey getDefaultInstanceForType()
Returns
Type Description
CryptoKey

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
Type Description
Descriptor
Overrides

getDestroyScheduledDuration()

public Duration getDestroyScheduledDuration()

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
Duration

The destroyScheduledDuration.

getDestroyScheduledDurationBuilder()

public Duration.Builder getDestroyScheduledDurationBuilder()

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
Builder

getDestroyScheduledDurationOrBuilder()

public DurationOrBuilder getDestroyScheduledDurationOrBuilder()

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
DurationOrBuilder

getImportOnly()

public boolean getImportOnly()

Immutable. Whether this key may contain imported versions only.

bool import_only = 13 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
boolean

The importOnly.

getKeyAccessJustificationsPolicy()

public KeyAccessJustificationsPolicy getKeyAccessJustificationsPolicy()

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
KeyAccessJustificationsPolicy

The keyAccessJustificationsPolicy.

getKeyAccessJustificationsPolicyBuilder()

public KeyAccessJustificationsPolicy.Builder getKeyAccessJustificationsPolicyBuilder()

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
KeyAccessJustificationsPolicy.Builder

getKeyAccessJustificationsPolicyOrBuilder()

public KeyAccessJustificationsPolicyOrBuilder getKeyAccessJustificationsPolicyOrBuilder()

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
KeyAccessJustificationsPolicyOrBuilder

getLabels() (deprecated)

public Map<String,String> getLabels()

Use #getLabelsMap() instead.

Returns
Type Description
Map<String,String>

getLabelsCount()

public int getLabelsCount()

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Returns
Type Description
int

getLabelsMap()

public Map<String,String> getLabelsMap()

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Returns
Type Description
Map<String,String>

getLabelsOrDefault(String key, String defaultValue)

public String getLabelsOrDefault(String key, String defaultValue)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameters
Name Description
key String
defaultValue String
Returns
Type Description
String

getLabelsOrThrow(String key)

public String getLabelsOrThrow(String key)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameter
Name Description
key String
Returns
Type Description
String

getMutableLabels() (deprecated)

public Map<String,String> getMutableLabels()

Use alternate mutation accessors instead.

Returns
Type Description
Map<String,String>

getName()

public String getName()

Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

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

Returns
Type Description
String

The name.

getNameBytes()

public ByteString getNameBytes()

Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

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

Returns
Type Description
ByteString

The bytes for name.

getNextRotationTime()

public Timestamp getNextRotationTime()

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Returns
Type Description
Timestamp

The nextRotationTime.

getNextRotationTimeBuilder()

public Timestamp.Builder getNextRotationTimeBuilder()

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Returns
Type Description
Builder

getNextRotationTimeOrBuilder()

public TimestampOrBuilder getNextRotationTimeOrBuilder()

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Returns
Type Description
TimestampOrBuilder

getPrimary()

public CryptoKeyVersion getPrimary()

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CryptoKeyVersion

The primary.

getPrimaryBuilder()

public CryptoKeyVersion.Builder getPrimaryBuilder()

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CryptoKeyVersion.Builder

getPrimaryOrBuilder()

public CryptoKeyVersionOrBuilder getPrimaryOrBuilder()

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
CryptoKeyVersionOrBuilder

getPurpose()

public CryptoKey.CryptoKeyPurpose getPurpose()

Immutable. The immutable purpose of this CryptoKey.

.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
CryptoKey.CryptoKeyPurpose

The purpose.

getPurposeValue()

public int getPurposeValue()

Immutable. The immutable purpose of this CryptoKey.

.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
int

The enum numeric value on the wire for purpose.

getRotationPeriod()

public Duration getRotationPeriod()

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Returns
Type Description
Duration

The rotationPeriod.

getRotationPeriodBuilder()

public Duration.Builder getRotationPeriodBuilder()

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Returns
Type Description
Builder

getRotationPeriodOrBuilder()

public DurationOrBuilder getRotationPeriodOrBuilder()

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Returns
Type Description
DurationOrBuilder

getRotationScheduleCase()

public CryptoKey.RotationScheduleCase getRotationScheduleCase()
Returns
Type Description
CryptoKey.RotationScheduleCase

getVersionTemplate()

public CryptoKeyVersionTemplate getVersionTemplate()

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Returns
Type Description
CryptoKeyVersionTemplate

The versionTemplate.

getVersionTemplateBuilder()

public CryptoKeyVersionTemplate.Builder getVersionTemplateBuilder()

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Returns
Type Description
CryptoKeyVersionTemplate.Builder

getVersionTemplateOrBuilder()

public CryptoKeyVersionTemplateOrBuilder getVersionTemplateOrBuilder()

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Returns
Type Description
CryptoKeyVersionTemplateOrBuilder

hasCreateTime()

public boolean hasCreateTime()

Output only. The time at which this CryptoKey was created.

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

Returns
Type Description
boolean

Whether the createTime field is set.

hasDestroyScheduledDuration()

public boolean hasDestroyScheduledDuration()

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Returns
Type Description
boolean

Whether the destroyScheduledDuration field is set.

hasKeyAccessJustificationsPolicy()

public boolean hasKeyAccessJustificationsPolicy()

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Returns
Type Description
boolean

Whether the keyAccessJustificationsPolicy field is set.

hasNextRotationTime()

public boolean hasNextRotationTime()

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Returns
Type Description
boolean

Whether the nextRotationTime field is set.

hasPrimary()

public boolean hasPrimary()

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Returns
Type Description
boolean

Whether the primary field is set.

hasRotationPeriod()

public boolean hasRotationPeriod()

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Returns
Type Description
boolean

Whether the rotationPeriod field is set.

hasVersionTemplate()

public boolean hasVersionTemplate()

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Returns
Type Description
boolean

Whether the versionTemplate field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
Type Description
FieldAccessorTable
Overrides

internalGetMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMapFieldReflection(int)

internalGetMutableMapFieldReflection(int number)

protected MapFieldReflectionAccessor internalGetMutableMapFieldReflection(int number)
Parameter
Name Description
number int
Returns
Type Description
com.google.protobuf.MapFieldReflectionAccessor
Overrides
com.google.protobuf.GeneratedMessageV3.Builder.internalGetMutableMapFieldReflection(int)

isInitialized()

public final boolean isInitialized()
Returns
Type Description
boolean
Overrides

mergeCreateTime(Timestamp value)

public CryptoKey.Builder mergeCreateTime(Timestamp value)

Output only. The time at which this CryptoKey was created.

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

Parameter
Name Description
value Timestamp
Returns
Type Description
CryptoKey.Builder

mergeDestroyScheduledDuration(Duration value)

public CryptoKey.Builder mergeDestroyScheduledDuration(Duration value)

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value Duration
Returns
Type Description
CryptoKey.Builder

mergeFrom(CryptoKey other)

public CryptoKey.Builder mergeFrom(CryptoKey other)
Parameter
Name Description
other CryptoKey
Returns
Type Description
CryptoKey.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public CryptoKey.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
Name Description
input CodedInputStream
extensionRegistry ExtensionRegistryLite
Returns
Type Description
CryptoKey.Builder
Overrides
Exceptions
Type Description
IOException

mergeFrom(Message other)

public CryptoKey.Builder mergeFrom(Message other)
Parameter
Name Description
other Message
Returns
Type Description
CryptoKey.Builder
Overrides

mergeKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy value)

public CryptoKey.Builder mergeKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy value)

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value KeyAccessJustificationsPolicy
Returns
Type Description
CryptoKey.Builder

mergeNextRotationTime(Timestamp value)

public CryptoKey.Builder mergeNextRotationTime(Timestamp value)

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Parameter
Name Description
value Timestamp
Returns
Type Description
CryptoKey.Builder

mergePrimary(CryptoKeyVersion value)

public CryptoKey.Builder mergePrimary(CryptoKeyVersion value)

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value CryptoKeyVersion
Returns
Type Description
CryptoKey.Builder

mergeRotationPeriod(Duration value)

public CryptoKey.Builder mergeRotationPeriod(Duration value)

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Parameter
Name Description
value Duration
Returns
Type Description
CryptoKey.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final CryptoKey.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
CryptoKey.Builder
Overrides

mergeVersionTemplate(CryptoKeyVersionTemplate value)

public CryptoKey.Builder mergeVersionTemplate(CryptoKeyVersionTemplate value)

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Parameter
Name Description
value CryptoKeyVersionTemplate
Returns
Type Description
CryptoKey.Builder

putAllLabels(Map<String,String> values)

public CryptoKey.Builder putAllLabels(Map<String,String> values)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameter
Name Description
values Map<String,String>
Returns
Type Description
CryptoKey.Builder

putLabels(String key, String value)

public CryptoKey.Builder putLabels(String key, String value)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameters
Name Description
key String
value String
Returns
Type Description
CryptoKey.Builder

removeLabels(String key)

public CryptoKey.Builder removeLabels(String key)

Labels with user-defined metadata. For more information, see Labeling Keys.

map<string, string> labels = 10;

Parameter
Name Description
key String
Returns
Type Description
CryptoKey.Builder

setCreateTime(Timestamp value)

public CryptoKey.Builder setCreateTime(Timestamp value)

Output only. The time at which this CryptoKey was created.

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

Parameter
Name Description
value Timestamp
Returns
Type Description
CryptoKey.Builder

setCreateTime(Timestamp.Builder builderForValue)

public CryptoKey.Builder setCreateTime(Timestamp.Builder builderForValue)

Output only. The time at which this CryptoKey was created.

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

Parameter
Name Description
builderForValue Builder
Returns
Type Description
CryptoKey.Builder

setCryptoKeyBackend(String value)

public CryptoKey.Builder setCryptoKeyBackend(String value)

Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/*. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future.

string crypto_key_backend = 15 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value String

The cryptoKeyBackend to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setCryptoKeyBackendBytes(ByteString value)

public CryptoKey.Builder setCryptoKeyBackendBytes(ByteString value)

Immutable. The resource name of the backend environment where the key material for all CryptoKeyVersions associated with this CryptoKey reside and where all related cryptographic operations are performed. Only applicable if CryptoKeyVersions have a ProtectionLevel of EXTERNAL_VPC, with the resource name in the format projects/*/locations/*/ekmConnections/*. Note, this list is non-exhaustive and may apply to additional ProtectionLevels in the future.

string crypto_key_backend = 15 [(.google.api.field_behavior) = IMMUTABLE, (.google.api.resource_reference) = { ... }

Parameter
Name Description
value ByteString

The bytes for cryptoKeyBackend to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setDestroyScheduledDuration(Duration value)

public CryptoKey.Builder setDestroyScheduledDuration(Duration value)

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value Duration
Returns
Type Description
CryptoKey.Builder

setDestroyScheduledDuration(Duration.Builder builderForValue)

public CryptoKey.Builder setDestroyScheduledDuration(Duration.Builder builderForValue)

Immutable. The period of time that versions of this key spend in the DESTROY_SCHEDULED state before transitioning to DESTROYED. If not specified at creation time, the default duration is 30 days.

.google.protobuf.Duration destroy_scheduled_duration = 14 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
builderForValue Builder
Returns
Type Description
CryptoKey.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public CryptoKey.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
Name Description
field FieldDescriptor
value Object
Returns
Type Description
CryptoKey.Builder
Overrides

setImportOnly(boolean value)

public CryptoKey.Builder setImportOnly(boolean value)

Immutable. Whether this key may contain imported versions only.

bool import_only = 13 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value boolean

The importOnly to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy value)

public CryptoKey.Builder setKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy value)

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
value KeyAccessJustificationsPolicy
Returns
Type Description
CryptoKey.Builder

setKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy.Builder builderForValue)

public CryptoKey.Builder setKeyAccessJustificationsPolicy(KeyAccessJustificationsPolicy.Builder builderForValue)

Optional. The policy used for Key Access Justifications Policy Enforcement. If this field is present and this key is enrolled in Key Access Justifications Policy Enforcement, the policy will be evaluated in encrypt, decrypt, and sign operations, and the operation will fail if rejected by the policy. The policy is defined by specifying zero or more allowed justification codes. https://cloud.google.com/assured-workloads/key-access-justifications/docs/justification-codes By default, this field is absent, and all justification codes are allowed.

.google.cloud.kms.v1.KeyAccessJustificationsPolicy key_access_justifications_policy = 17 [(.google.api.field_behavior) = OPTIONAL];

Parameter
Name Description
builderForValue KeyAccessJustificationsPolicy.Builder
Returns
Type Description
CryptoKey.Builder

setName(String value)

public CryptoKey.Builder setName(String value)

Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

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

Parameter
Name Description
value String

The name to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setNameBytes(ByteString value)

public CryptoKey.Builder setNameBytes(ByteString value)

Output only. The resource name for this CryptoKey in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

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

Parameter
Name Description
value ByteString

The bytes for name to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setNextRotationTime(Timestamp value)

public CryptoKey.Builder setNextRotationTime(Timestamp value)

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Parameter
Name Description
value Timestamp
Returns
Type Description
CryptoKey.Builder

setNextRotationTime(Timestamp.Builder builderForValue)

public CryptoKey.Builder setNextRotationTime(Timestamp.Builder builderForValue)

At next_rotation_time, the Key Management Service will automatically:

  1. Create a new version of this CryptoKey.
  2. Mark the new version as primary.

    Key rotations performed manually via CreateCryptoKeyVersion and UpdateCryptoKeyPrimaryVersion do not affect next_rotation_time.

    Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Timestamp next_rotation_time = 7;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
CryptoKey.Builder

setPrimary(CryptoKeyVersion value)

public CryptoKey.Builder setPrimary(CryptoKeyVersion value)

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
value CryptoKeyVersion
Returns
Type Description
CryptoKey.Builder

setPrimary(CryptoKeyVersion.Builder builderForValue)

public CryptoKey.Builder setPrimary(CryptoKeyVersion.Builder builderForValue)

Output only. A copy of the "primary" CryptoKeyVersion that will be used by Encrypt when this CryptoKey is given in EncryptRequest.name.

The CryptoKey's primary version can be updated via UpdateCryptoKeyPrimaryVersion.

Keys with purpose ENCRYPT_DECRYPT may have a primary. For other keys, this field will be omitted.

.google.cloud.kms.v1.CryptoKeyVersion primary = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];

Parameter
Name Description
builderForValue CryptoKeyVersion.Builder
Returns
Type Description
CryptoKey.Builder

setPurpose(CryptoKey.CryptoKeyPurpose value)

public CryptoKey.Builder setPurpose(CryptoKey.CryptoKeyPurpose value)

Immutable. The immutable purpose of this CryptoKey.

.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value CryptoKey.CryptoKeyPurpose

The purpose to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setPurposeValue(int value)

public CryptoKey.Builder setPurposeValue(int value)

Immutable. The immutable purpose of this CryptoKey.

.google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose purpose = 3 [(.google.api.field_behavior) = IMMUTABLE];

Parameter
Name Description
value int

The enum numeric value on the wire for purpose to set.

Returns
Type Description
CryptoKey.Builder

This builder for chaining.

setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)

public CryptoKey.Builder setRepeatedField(Descriptors.FieldDescriptor field, int index, Object value)
Parameters
Name Description
field FieldDescriptor
index int
value Object
Returns
Type Description
CryptoKey.Builder
Overrides

setRotationPeriod(Duration value)

public CryptoKey.Builder setRotationPeriod(Duration value)

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Parameter
Name Description
value Duration
Returns
Type Description
CryptoKey.Builder

setRotationPeriod(Duration.Builder builderForValue)

public CryptoKey.Builder setRotationPeriod(Duration.Builder builderForValue)

next_rotation_time will be advanced by this period when the service automatically rotates a key. Must be at least 24 hours and at most 876,000 hours.

If rotation_period is set, next_rotation_time must also be set.

Keys with purpose ENCRYPT_DECRYPT support automatic rotation. For other keys, this field must be omitted.

.google.protobuf.Duration rotation_period = 8;

Parameter
Name Description
builderForValue Builder
Returns
Type Description
CryptoKey.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final CryptoKey.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
Name Description
unknownFields UnknownFieldSet
Returns
Type Description
CryptoKey.Builder
Overrides

setVersionTemplate(CryptoKeyVersionTemplate value)

public CryptoKey.Builder setVersionTemplate(CryptoKeyVersionTemplate value)

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Parameter
Name Description
value CryptoKeyVersionTemplate
Returns
Type Description
CryptoKey.Builder

setVersionTemplate(CryptoKeyVersionTemplate.Builder builderForValue)

public CryptoKey.Builder setVersionTemplate(CryptoKeyVersionTemplate.Builder builderForValue)

A template describing settings for new CryptoKeyVersion instances. The properties of new CryptoKeyVersion instances created by either CreateCryptoKeyVersion or auto-rotation are controlled by this template.

.google.cloud.kms.v1.CryptoKeyVersionTemplate version_template = 11;

Parameter
Name Description
builderForValue CryptoKeyVersionTemplate.Builder
Returns
Type Description
CryptoKey.Builder