Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

Add gcs SSE-KMS support #24

Merged
merged 2 commits into from
Apr 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion service.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ optional = ["list_mode"]
optional = ["offset", "io_callback", "size", "encryption_key"]

[namespace.storage.op.write]
optional = ["content_md5", "content_type", "io_callback", "storage_class", "encryption_key"]
optional = ["content_md5", "content_type", "io_callback", "storage_class", "encryption_key", "kms_key_name"]

[pairs.encryption_key]
type = "byte_array"
description = "is the customer's 32-byte AES-256 key"

[pairs.kms_key_name]
type = "string"
description = "is the Cloud KMS key resource. For example, projects/my-pet-project/locations/us-east1/keyRings/my-key-ring/cryptoKeys/my-key."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could attach the docs link here?


[pairs.default_service_pairs]
type = "DefaultServicePairs"
description = "set default pairs for service actions"
Expand Down
3 changes: 3 additions & 0 deletions storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ func (s *Storage) write(ctx context.Context, path string, r io.Reader, size int6
if opt.HasStorageClass {
w.StorageClass = opt.StorageClass
}
if opt.HasKmsKeyName {
w.KMSKeyName = opt.KmsKeyName
}
if opt.HasIoCallback {
r = iowrap.CallbackReader(r, opt.IoCallback)
}
Expand Down