Repository navigation
feat(secretmanager): add Cloud SQL managed rotation and secret type samples - #3347
suvidha-malaviya wants to merge 5 commits into
Conversation
…amples Add C# samples and tests for creating a Cloud SQL credentials secret, enabling, rotating and scheduling managed rotation, and creating/getting secrets by secret type. Bump Google.Cloud.SecretManager.V1 to 2.8.0.
There was a problem hiding this comment.
Code Review
This pull request introduces new C# sample codes and integration tests for Google Cloud Secret Manager, specifically covering regional secrets, secret types, and managed rotation for Cloud SQL database credentials. The review feedback highlights several critical issues in the test suite and test fixture where created secrets and IAM role bindings could be leaked in the GCP project if assertions fail or exceptions are thrown during setup. It is highly recommended to wrap these operations in try-finally or try-catch blocks to guarantee robust resource cleanup.
|
Here is the summary of changes. You are about to add 7 region tags.
This comment is generated by snippet-bot.
|
…ation samples Align comments with other samples, simplify summaries and clarify rotation schedule behavior.
YashSaraf11
left a comment
There was a problem hiding this comment.
Reviewed the Cloud SQL Managed Rotation and Secret Type .NET 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):
(Note: The 2 |
YashSaraf11
left a comment
There was a problem hiding this comment.
LGTM! Thanks for adding the CI skip guards.
Adds C# samples and integration tests for Secret Manager Cloud SQL managed rotation and secret types.
Regional samples
CreateRegionalSecretWithCloudSqlCredentials: creates a secret of typeCLOUD_SQL_DB_CREDENTIALS.EnableRegionalSecretManagedRotation: links the secret to a Cloud SQL instance and user, and creates version 1.RotateRegionalSecret: triggers a rotation on demand.UpdateRegionalSecretWithManagedRotationSchedule: sets the recurring schedule. The update mask namesrotation.next_rotation_timeandrotation.rotation_periodrather than the wholerotationmessage.GetRegionalSecretTypeGlobal samples
CreateSecretWithType: takes the secret type as a parameter.GetSecretTypeOther changes
Google.Cloud.SecretManager.V1from 2.6.0 to 2.8.0, the first version with managed rotation support.RegionalSecretManagerFixturenow grants and revokesroles/cloudsql.adminfor each test secret's own identity, because the grant is per-secret.