Repository navigation
feat(secretmanager): Add Cloud SQL managed-rotation samples - #10348
YashSaraf11 merged 6 commits into
Conversation
Not part of the automated test suite; dropping it from the sample directory.
There was a problem hiding this comment.
Code Review
This pull request introduces new Java samples and integration tests for Google Cloud Secret Manager, specifically focusing on creating secrets with type restrictions and managing regional secrets with Cloud SQL managed rotation. The feedback suggests improving code maintainability by using standard protobuf utility classes (Timestamps and Durations) to build timestamp and duration objects, and enhancing test reliability by adding a backoff sleep when retrying on AbortedException during IAM policy updates.
…latform#10348 - UpdateRegionalSecretWithManagedRotationSchedule.java: build the Timestamp/Duration via com.google.protobuf.util.Timestamps/Durations instead of manual builders. - SnippetsIT.java: add backoff between AbortedException retries in grantCloudSqlRole and revokeCloudSqlRole to reduce contention.
- UpdateRegionalSecretWithManagedRotationSchedule.java: build the Timestamp/Duration via com.google.protobuf.util.Timestamps/Durations instead of manual builders. - SnippetsIT.java: add backoff between AbortedException retries in grantCloudSqlRole and revokeCloudSqlRole to reduce contention.
22c4ce4 to
8370800
Compare
…ation samples Align Javadoc with other samples, simplify comments, clarify rotation schedule behavior and mask placeholder project ids.
YashSaraf11
left a comment
There was a problem hiding this comment.
Reviewed the Cloud SQL Managed Rotation and Secret Type Java samples. Left inline comments categorized into [Must], [Warning], and [Nit].
YashSaraf11
left a comment
There was a problem hiding this comment.
LGTM! All review comments have been addressed.
|
Kokoro CI ( To match Go, Node.js, and PHP (which skip Cloud SQL managed-rotation tests when those env vars are absent), please update
|
Description
Adds samples for Secret Manager's Cloud SQL managed-rotation feature (regional secrets only — this feature isn't available for global secrets):
Also added two global scenario with secret-type:
Sample List (global & regional):
CreateSecretWithType.java(secret-type restriction is global-only — no regional counterpart)GetSecretType.java/GetRegionalSecretType.javaCreateRegionalSecretWithCloudSqlCredentials.javaEnableRegionalSecretManagedRotation.javaRotateRegionalSecret.javaUpdateRegionalSecretWithManagedRotationSchedule.javaAdded required tests for all of the above in
SnippetsIT.java(regional and global).Also bumps
google-cloud-secretmanager/proto-google-cloud-secretmanager-v1from 2.66.0 → 2.98.0 (and thegoogle-cloud-bomimport from 26.62.0 → 26.89.0) — minimum version with Cloud SQL managed-rotation support.Checklist
Testing
mvn clean verifyrequiredmvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory onlyCompliance & Style
pom.xmlparent set to latestshared-configurationsqladmin.googleapis.com)-
CLOUD_SQL_INSTANCE/CLOUD_SQL_USER— a pre-provisioned, long-lived Cloud SQL instance + DB user for managed-rotation tests to point at- The identity running these tests additionally needs
resourcemanager.projects.getIamPolicy/setIamPolicyon the test project (e.g.roles/resourcemanager.projectIamAdmin)Post-Approval Actions