Skip to content

Commit 6c76936

Browse files
Google APIscopybara-github
authored andcommitted
feat: Rotation for Secrets
Users can now configure rotation schedules for their secrets. Secret Manager sends messages to PubSub topics configured on the secret based on the provided rotation frequency and rotation time. Committer: @rlingutla PiperOrigin-RevId: 365574085
1 parent 6ce40ff commit 6c76936

2 files changed

Lines changed: 39 additions & 4 deletions

File tree

google/cloud/secretmanager/v1/BUILD.bazel

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# This file was automatically generated by BuildFileGenerator
2+
# https://github.com/googleapis/rules_gapic/tree/master/bazel
3+
4+
# Most of the manual changes to this file will be overwritten.
5+
# It's **only** allowed to change the following rule attribute values:
6+
# - names of *_gapic_assembly_* rules
7+
# - certain parameters of *_gapic_library rules, including but not limited to:
8+
# * extra_protoc_parameters
9+
# * extra_protoc_file_parameters
10+
# The complete list of preserved parameters can be found in the source code.
211

312
# This is an API workspace, having public visibility by default makes perfect sense.
413
package(default_visibility = ["//visibility:public"])
@@ -120,10 +129,12 @@ go_gapic_library(
120129
srcs = [":secretmanager_proto_with_info"],
121130
grpc_service_config = "secretmanager_grpc_service_config.json",
122131
importpath = "cloud.google.com/go/secretmanager/apiv1;secretmanager",
132+
metadata = True,
123133
service_yaml = "secretmanager_v1.yaml",
124134
deps = [
125135
":secretmanager_go_proto",
126136
"//google/iam/v1:iam_go_proto",
137+
"@io_bazel_rules_go//proto/wkt:duration_go_proto",
127138
],
128139
)
129140

@@ -139,6 +150,7 @@ go_gapic_assembly_pkg(
139150
name = "gapi-cloud-secretmanager-v1-go",
140151
deps = [
141152
":secretmanager_go_gapic",
153+
":secretmanager_go_gapic_srcjar-metadata.srcjar",
142154
":secretmanager_go_gapic_srcjar-test.srcjar",
143155
":secretmanager_go_proto",
144156
],
@@ -159,6 +171,7 @@ py_gapic_library(
159171
grpc_service_config = "secretmanager_grpc_service_config.json",
160172
)
161173

174+
# Open Source Packages
162175
py_gapic_assembly_pkg(
163176
name = "secretmanager-v1-py",
164177
deps = [
@@ -244,8 +257,8 @@ nodejs_gapic_assembly_pkg(
244257
##############################################################################
245258
load(
246259
"@com_google_googleapis_imports//:imports.bzl",
247-
"ruby_gapic_assembly_pkg",
248260
"ruby_cloud_gapic_library",
261+
"ruby_gapic_assembly_pkg",
249262
"ruby_grpc_library",
250263
"ruby_proto_library",
251264
)
@@ -265,11 +278,11 @@ ruby_cloud_gapic_library(
265278
name = "secretmanager_ruby_gapic",
266279
srcs = [":secretmanager_proto_with_info"],
267280
extra_protoc_parameters = [
268-
"ruby-cloud-gem-name=google-cloud-secret_manager-v1",
269-
"ruby-cloud-env-prefix=SECRET_MANAGER",
270-
"ruby-cloud-product-url=https://cloud.google.com/secret-manager",
271281
"ruby-cloud-api-id=secretmanager.googleapis.com",
272282
"ruby-cloud-api-shortname=secretmanager",
283+
"ruby-cloud-env-prefix=SECRET_MANAGER",
284+
"ruby-cloud-gem-name=google-cloud-secret_manager-v1",
285+
"ruby-cloud-product-url=https://cloud.google.com/secret-manager",
273286
],
274287
grpc_service_config = "secretmanager_grpc_service_config.json",
275288
ruby_cloud_description = "Secret Manager is a secure and convenient storage system for API keys, passwords, certificates, and other sensitive data. Secret Manager provides a central place and single source of truth to manage, access, and audit secrets across Google Cloud.",

google/cloud/secretmanager/v1/resources.proto

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ message Secret {
9090
// Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret].
9191
google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY];
9292
}
93+
94+
// Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is no
95+
// rotation policy.
96+
Rotation rotation = 9 [(google.api.field_behavior) = OPTIONAL];
9397
}
9498

9599
// A secret version resource in the Secret Manager API.
@@ -278,6 +282,24 @@ message Topic {
278282
string name = 1 [(google.api.field_behavior) = REQUIRED];
279283
}
280284

285+
// The rotation time and period for a [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret
286+
// Manager will send a Pub/Sub notification to the topics configured on the
287+
// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be set to configure rotation.
288+
message Rotation {
289+
// Optional. Timestamp in UTC at which the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate.
290+
//
291+
// [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] MUST be set if [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set.
292+
google.protobuf.Timestamp next_rotation_time = 1 [(google.api.field_behavior) = OPTIONAL];
293+
294+
// Input only. The Duration between rotation notifications. Must be in seconds
295+
// and at least 3600s (1h) and at most 3153600000s (100 years).
296+
//
297+
// If [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set, [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] must be set.
298+
// [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] will be advanced by this period when the service
299+
// automatically sends rotation notifications.
300+
google.protobuf.Duration rotation_period = 2 [(google.api.field_behavior) = INPUT_ONLY];
301+
}
302+
281303
// A secret payload resource in the Secret Manager API. This contains the
282304
// sensitive secret payload that is associated with a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].
283305
message SecretPayload {

0 commit comments

Comments
 (0)