Required. Resource name of the Cloud KMS key that will be used to encrypt
the object. The Cloud KMS key must be located in same location as the
object. Refer to
https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key
for additional documentation. Format:
projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
For example:
"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
The object will be rewritten and set with the specified KMS key.
Required. Resource name of the Cloud KMS key that will be used to encrypt
the object. The Cloud KMS key must be located in same location as the
object. Refer to
https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key
for additional documentation. Format:
projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
For example:
"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
The object will be rewritten and set with the specified KMS key.
Required. Resource name of the Cloud KMS key that will be used to encrypt
the object. The Cloud KMS key must be located in same location as the
object. Refer to
https://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key
for additional documentation. Format:
projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}
For example:
"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key".
The object will be rewritten and set with the specified KMS key.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Interface RewriteObjectOrBuilder (0.12.0)\n\nVersion latestkeyboard_arrow_down\n\n- [0.12.0 (latest)](/java/docs/reference/google-cloud-storagebatchoperations/latest/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.10.0](/java/docs/reference/google-cloud-storagebatchoperations/0.10.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.8.0](/java/docs/reference/google-cloud-storagebatchoperations/0.8.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.7.0](/java/docs/reference/google-cloud-storagebatchoperations/0.7.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.4.0](/java/docs/reference/google-cloud-storagebatchoperations/0.4.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.3.0](/java/docs/reference/google-cloud-storagebatchoperations/0.3.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder)\n- [0.2.0](/java/docs/reference/google-cloud-storagebatchoperations/0.2.0/com.google.cloud.storagebatchoperations.v1.RewriteObjectOrBuilder) \n\n public interface RewriteObjectOrBuilder extends MessageOrBuilder\n\nImplements\n----------\n\n[MessageOrBuilder](https://cloud.google.com/java/docs/reference/protobuf/latest/com.google.protobuf.MessageOrBuilder.html)\n\nMethods\n-------\n\n### getKmsKey()\n\n public abstract String getKmsKey()\n\nRequired. Resource name of the Cloud KMS key that will be used to encrypt\nthe object. The Cloud KMS key must be located in same location as the\nobject. Refer to\n\u003chttps://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key\u003e\nfor additional documentation. Format:\nprojects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}\nFor example:\n\"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key\".\nThe object will be rewritten and set with the specified KMS key.\n\n`\noptional string kms_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }\n`\n\n### getKmsKeyBytes()\n\n public abstract ByteString getKmsKeyBytes()\n\nRequired. Resource name of the Cloud KMS key that will be used to encrypt\nthe object. The Cloud KMS key must be located in same location as the\nobject. Refer to\n\u003chttps://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key\u003e\nfor additional documentation. Format:\nprojects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}\nFor example:\n\"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key\".\nThe object will be rewritten and set with the specified KMS key.\n\n`\noptional string kms_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }\n`\n\n### hasKmsKey()\n\n public abstract boolean hasKmsKey()\n\nRequired. Resource name of the Cloud KMS key that will be used to encrypt\nthe object. The Cloud KMS key must be located in same location as the\nobject. Refer to\n\u003chttps://cloud.google.com/storage/docs/encryption/using-customer-managed-keys#add-object-key\u003e\nfor additional documentation. Format:\nprojects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}\nFor example:\n\"projects/123456/locations/us-central1/keyRings/my-keyring/cryptoKeys/my-key\".\nThe object will be rewritten and set with the specified KMS key.\n\n`\noptional string kms_key = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... }\n`"]]