-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(secretmanager): Adding etag samples #4219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(secretmanager): Adding etag samples #4219
Conversation
…odejs-docs-samples into node_list_samples
…odejs-docs-samples into node_cmek_samples
Summary of ChangesHello @khilan-crest, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands the Node.js sample collection for Google Cloud Secret Manager. It introduces a wide array of new functionalities, including advanced secret creation options, lifecycle management (expiration, rotation), concurrency control using ETags, and integration with other Google Cloud services like Pub/Sub and KMS. Furthermore, it provides a complete suite of regional Secret Manager samples, ensuring comprehensive coverage for various deployment scenarios. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
The pull request introduces several new samples for Secret Manager, covering features like CMEK, expiration, rotation, user-managed replication, tag bindings, and etag operations for both global and regional secrets and versions. The accompanying test file has been updated to include comprehensive tests for these new functionalities, which is great. However, there are a few minor issues related to asynchronous function calls and type handling that should be addressed.
| }, | ||
| }, | ||
| ttl: { | ||
| seconds: ttl, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
|
||
| console.log(`Created secret ${secret.name} with CMEK key ${kmsKeyName}`); | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createRegionalSecretWithCmek function is async, but it's called without await in the main function. This means main might complete before the secret creation is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| await createRegionalSecretWithCmek(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
|
|
||
| enableRegionalSecretVersionWithEtag(); | ||
| // [END secretmanager_enable_regional_secret_version_with_etag] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The enableRegionalSecretVersionWithEtag function is async, but it's called without await in the main function. This means main might complete before the version enabling is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
await enableRegionalSecretVersionWithEtag();There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| ); | ||
| } | ||
|
|
||
| createSecretWithExpiration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The createSecretWithExpiration function is async, but it's called without await in the main function. This means main might complete before the secret creation is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| createSecretWithExpiration(); | |
| await createSecretWithExpiration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| console.log(`Created secret: ${secret.name}`); | ||
| } | ||
|
|
||
| createUmmrSecret(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
|
|
||
| updateRegionalSecretRotationPeriod(); | ||
| // [END secretmanager_update_regional_secret_rotation_period] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateRegionalSecretRotationPeriod function is async, but it's called without await in the main function. This means main might complete before the secret update is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
await updateRegionalSecretRotationPeriod();There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| } | ||
|
|
||
| updateRegionalSecretWithEtag(); | ||
| // [END secretmanager_v1_update_regional_secret_with_etag] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateRegionalSecretWithEtag function is async, but it's called without await in the main function. This means main might complete before the secret update is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| // [END secretmanager_v1_update_regional_secret_with_etag] | |
| await updateRegionalSecretWithEtag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| ); | ||
| } | ||
|
|
||
| updateSecretExpiration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateSecretExpiration function is async, but it's called without await in the main function. This means main might complete before the secret update is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| updateSecretExpiration(); | |
| await updateSecretExpiration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| ); | ||
| } | ||
|
|
||
| updateSecretRotation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateSecretRotation function is async, but it's called without await in the main function. This means main might complete before the secret update is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| updateSecretRotation(); | |
| await updateSecretRotation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
| } | ||
|
|
||
| updateSecretWithEtag(); | ||
| // [END secretmanager_update_secret_with_etag] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The updateSecretWithEtag function is async, but it's called without await in the main function. This means main might complete before the secret update is finished, potentially leading to unexpected behavior or unhandled rejections. Please await the call.
| // [END secretmanager_update_secret_with_etag] | |
| await updateSecretWithEtag(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await is added within function wherever required.
…odejs-docs-samples into node_expiretime_samples
…rest/nodejs-docs-samples into node_rotation_samples
…st/nodejs-docs-samples into node_etag_samples
Adding etag samples
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
npm test(see Testing)npm run lint(see Style)GoogleCloudPlatform/nodejs-docs-samples. Not a fork.