Class CryptoKey.Builder (2.23.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
TypeDescription
Descriptor

Methods

addRepeatedField(Descriptors.FieldDescriptor field, Object value)

public CryptoKey.Builder addRepeatedField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
CryptoKey.Builder
Overrides

build()

public CryptoKey build()
Returns
TypeDescription
CryptoKey

buildPartial()

public CryptoKey buildPartial()
Returns
TypeDescription
CryptoKey

clear()

public CryptoKey.Builder clear()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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 24 hours.

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

Returns
TypeDescription
CryptoKey.Builder

clearField(Descriptors.FieldDescriptor field)

public CryptoKey.Builder clearField(Descriptors.FieldDescriptor field)
Parameter
NameDescription
fieldFieldDescriptor
Returns
TypeDescription
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
TypeDescription
CryptoKey.Builder

This builder for chaining.

clearLabels()

public CryptoKey.Builder clearLabels()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
CryptoKey.Builder

clearOneof(Descriptors.OneofDescriptor oneof)

public CryptoKey.Builder clearOneof(Descriptors.OneofDescriptor oneof)
Parameter
NameDescription
oneofOneofDescriptor
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
CryptoKey.Builder

clearRotationSchedule()

public CryptoKey.Builder clearRotationSchedule()
Returns
TypeDescription
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
TypeDescription
CryptoKey.Builder

clone()

public CryptoKey.Builder clone()
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
ByteString

The bytes for cryptoKeyBackend.

getDefaultInstanceForType()

public CryptoKey getDefaultInstanceForType()
Returns
TypeDescription
CryptoKey

getDescriptorForType()

public Descriptors.Descriptor getDescriptorForType()
Returns
TypeDescription
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 24 hours.

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

Returns
TypeDescription
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 24 hours.

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

Returns
TypeDescription
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 24 hours.

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

Returns
TypeDescription
DurationOrBuilder

getImportOnly()

public boolean getImportOnly()

Immutable. Whether this key may contain imported versions only.

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

Returns
TypeDescription
boolean

The importOnly.

getLabels()

public Map<String,String> getLabels()

Use #getLabelsMap() instead.

Returns
TypeDescription
Map<String,String>

getLabelsCount()

public int getLabelsCount()

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

map<string, string> labels = 10;

Returns
TypeDescription
int

getLabelsMap()

public Map<String,String> getLabelsMap()

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

map<string, string> labels = 10;

Returns
TypeDescription
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
NameDescription
keyString
defaultValueString
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
String

getMutableLabels()

public Map<String,String> getMutableLabels()

Use alternate mutation accessors instead.

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
DurationOrBuilder

getRotationScheduleCase()

public CryptoKey.RotationScheduleCase getRotationScheduleCase()
Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
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 24 hours.

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

Returns
TypeDescription
boolean

Whether the destroyScheduledDuration 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
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
boolean

Whether the versionTemplate field is set.

internalGetFieldAccessorTable()

protected GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
Returns
TypeDescription
FieldAccessorTable
Overrides

internalGetMapField(int number)

protected MapField internalGetMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

internalGetMutableMapField(int number)

protected MapField internalGetMutableMapField(int number)
Parameter
NameDescription
numberint
Returns
TypeDescription
MapField
Overrides

isInitialized()

public final boolean isInitialized()
Returns
TypeDescription
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
NameDescription
valueTimestamp
Returns
TypeDescription
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 24 hours.

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

Parameter
NameDescription
valueDuration
Returns
TypeDescription
CryptoKey.Builder

mergeFrom(CryptoKey other)

public CryptoKey.Builder mergeFrom(CryptoKey other)
Parameter
NameDescription
otherCryptoKey
Returns
TypeDescription
CryptoKey.Builder

mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)

public CryptoKey.Builder mergeFrom(CodedInputStream input, ExtensionRegistryLite extensionRegistry)
Parameters
NameDescription
inputCodedInputStream
extensionRegistryExtensionRegistryLite
Returns
TypeDescription
CryptoKey.Builder
Overrides
Exceptions
TypeDescription
IOException

mergeFrom(Message other)

public CryptoKey.Builder mergeFrom(Message other)
Parameter
NameDescription
otherMessage
Returns
TypeDescription
CryptoKey.Builder
Overrides

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
NameDescription
valueTimestamp
Returns
TypeDescription
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
NameDescription
valueCryptoKeyVersion
Returns
TypeDescription
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
NameDescription
valueDuration
Returns
TypeDescription
CryptoKey.Builder

mergeUnknownFields(UnknownFieldSet unknownFields)

public final CryptoKey.Builder mergeUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valueCryptoKeyVersionTemplate
Returns
TypeDescription
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
NameDescription
valuesMap<String,String>
Returns
TypeDescription
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
NameDescription
keyString
valueString
Returns
TypeDescription
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
NameDescription
keyString
Returns
TypeDescription
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
NameDescription
valueTimestamp
Returns
TypeDescription
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
NameDescription
builderForValueBuilder
Returns
TypeDescription
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
NameDescription
valueString

The cryptoKeyBackend to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for cryptoKeyBackend to set.

Returns
TypeDescription
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 24 hours.

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

Parameter
NameDescription
valueDuration
Returns
TypeDescription
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 24 hours.

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

Parameter
NameDescription
builderForValueBuilder
Returns
TypeDescription
CryptoKey.Builder

setField(Descriptors.FieldDescriptor field, Object value)

public CryptoKey.Builder setField(Descriptors.FieldDescriptor field, Object value)
Parameters
NameDescription
fieldFieldDescriptor
valueObject
Returns
TypeDescription
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
NameDescription
valueboolean

The importOnly to set.

Returns
TypeDescription
CryptoKey.Builder

This builder for chaining.

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
NameDescription
valueString

The name to set.

Returns
TypeDescription
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
NameDescription
valueByteString

The bytes for name to set.

Returns
TypeDescription
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
NameDescription
valueTimestamp
Returns
TypeDescription
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
NameDescription
builderForValueBuilder
Returns
TypeDescription
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
NameDescription
valueCryptoKeyVersion
Returns
TypeDescription
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
NameDescription
builderForValueCryptoKeyVersion.Builder
Returns
TypeDescription
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
NameDescription
valueCryptoKey.CryptoKeyPurpose

The purpose to set.

Returns
TypeDescription
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
NameDescription
valueint

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

Returns
TypeDescription
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
NameDescription
fieldFieldDescriptor
indexint
valueObject
Returns
TypeDescription
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
NameDescription
valueDuration
Returns
TypeDescription
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
NameDescription
builderForValueBuilder
Returns
TypeDescription
CryptoKey.Builder

setUnknownFields(UnknownFieldSet unknownFields)

public final CryptoKey.Builder setUnknownFields(UnknownFieldSet unknownFields)
Parameter
NameDescription
unknownFieldsUnknownFieldSet
Returns
TypeDescription
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
NameDescription
valueCryptoKeyVersionTemplate
Returns
TypeDescription
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
NameDescription
builderForValueCryptoKeyVersionTemplate.Builder
Returns
TypeDescription
CryptoKey.Builder