-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(secretmanager): Adding tags samples #4215
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 tags samples #4215
Conversation
|
Here is the summary of changes. You are about to add 8 region tags.
This comment is generated by snippet-bot.
|
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 Google Cloud Secret Manager Node.js samples by introducing new functionalities related to tag management and filtered listing of secrets and their versions. It provides developers with practical code examples for detaching and listing tag bindings, as well as filtering secrets and secret versions based on specific criteria, with full support for regional deployments. 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
This pull request adds several new samples for interacting with Google Cloud Secret Manager, focusing on tags and filtering. The new samples demonstrate how to list secrets and secret versions with filters, and how to list and detach tag bindings for both global and regional secrets. The changes also include corresponding tests for the new samples. My review focuses on ensuring the correctness and robustness of the new sample code. I've identified a recurring issue across several new files related to improper handling of asynchronous operations, which could lead to unhandled promise rejections and incorrect script behavior. I've provided suggestions to fix this.
| console.log(`Detached tag value ${tagValue} from ${name}`); | ||
| } | ||
|
|
||
| detachTag(); |
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 detachTag function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within detachTag, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| detachTag(); | |
| await detachTag(); |
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.
Within Function await is added wherever required
| }); | ||
| } | ||
|
|
||
| listSecretVersionsWithFilter(); |
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 listSecretVersionsWithFilter function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listSecretVersionsWithFilter, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listSecretVersionsWithFilter(); | |
| await listSecretVersionsWithFilter(); |
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.
Within Function await is added wherever required
| } | ||
| } | ||
|
|
||
| listSecretsWithFilter(); |
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 listSecretsWithFilter function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listSecretsWithFilter, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listSecretsWithFilter(); | |
| await listSecretsWithFilter(); |
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.
| } | ||
| } | ||
|
|
||
| listTagBindings(); |
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 listTagBindings function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listTagBindings, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listTagBindings(); | |
| await listTagBindings(); |
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.
| }); | ||
| } | ||
|
|
||
| listRegionalSecretVersionsWithFilter(); |
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 listRegionalSecretVersionsWithFilter function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listRegionalSecretVersionsWithFilter, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listRegionalSecretVersionsWithFilter(); | |
| await listRegionalSecretVersionsWithFilter(); |
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.
| }); | ||
| } | ||
|
|
||
| listRegionalSecretsWithFilter(); |
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 listRegionalSecretsWithFilter function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listRegionalSecretsWithFilter, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listRegionalSecretsWithFilter(); | |
| await listRegionalSecretsWithFilter(); |
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.
| } | ||
| } | ||
|
|
||
| listRegionalSecretTagBindings(); |
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 listRegionalSecretTagBindings function is an async function. By calling it without await, you are creating a 'fire-and-forget' promise. If an error occurs within listRegionalSecretTagBindings, it will cause an unhandled promise rejection, which can crash the process, instead of being caught by the .catch(console.error) at the end of the file. To ensure proper error handling and that the main function waits for completion, you should await this call.
| listRegionalSecretTagBindings(); | |
| await listRegionalSecretTagBindings(); |
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.
Adding tags samples
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.