-
Notifications
You must be signed in to change notification settings - Fork 2k
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
feat(parametermanager): Added global samples to create list render parameter and version #4012
base: main
Are you sure you want to change the base?
Conversation
…github.com:vatsal-vora-crestdata/nodejs-docs-samples into parametermanager-global-samples-create-list-render
Here is the summary of changes. You are about to add 10 region tags.
This comment is generated by snippet-bot.
|
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.
Hello @vatsal-vora-crestdata, 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!
Summary of Changes
This pull request introduces samples for creating, listing, and rendering parameters and parameter versions using the Google Cloud Parameter Manager. It includes samples for both structured and unstructured data, as well as examples for referencing secrets within parameters. The changes include new JavaScript files for each sample, a new GitHub Actions workflow file, and an update to the workflows JSON file.
Highlights
- New Samples: Adds nine new samples demonstrating various Parameter Manager functionalities, including creating parameters with structured and unstructured data, adding parameter versions, referencing secrets, listing parameters and versions, and rendering parameter versions.
- GitHub Actions Workflow: Introduces a new workflow file (
parameter-manager.yaml
) to automate testing for the Parameter Manager samples. - Workflow Configuration: Updates the
workflows.json
file to include the new 'parameter-manager' workflow.
Changelog
Click here to see the changelog
- .github/workflows/parameter-manager.yaml
- Adds a new GitHub Actions workflow for the parameter-manager samples.
- Configures the workflow to run on push and pull requests to the main branch, as well as on a schedule.
- Includes jobs for testing and flaky bot analysis.
- .github/workflows/utils/workflows.json
- Adds 'parameter-manager' to the list of workflows.
- parametermanager/createParam.js
- Creates a global parameter using the Parameter Manager SDK.
- Takes projectId and parameterId as input.
- Uses @google-cloud/parametermanager library to instantiate a client and create the parameter.
- parametermanager/createParamVersion.js
- Creates a parameter version globally for unstructured data.
- Takes projectId, parameterId, parameterVersionId, and payload as input.
- Uses @google-cloud/parametermanager library to create the parameter version with the given payload.
- parametermanager/createParamVersionWithSecret.js
- Creates a new version of an existing parameter with secret references.
- Takes projectId, parameterId, parameterVersionId, and secretId as input.
- Constructs a JSON payload with a secret reference and creates the parameter version.
- parametermanager/createStructuredParam.js
- Creates a parameter with a specified format (JSON, YAML, UNFORMATTED).
- Takes projectId, parameterId, and formatType as input.
- Uses @google-cloud/parametermanager library to create the structured parameter.
- parametermanager/createStructuredParamVersion.js
- Creates a new version of an existing parameter with a JSON payload.
- Takes projectId, parameterId, parameterVersionId, and payload as input.
- Uses @google-cloud/parametermanager library to create the structured parameter version.
- parametermanager/getParam.js
- Retrieves a parameter from the global location.
- Takes projectId and parameterId as input.
- Uses @google-cloud/parametermanager library to get the parameter and prints its format.
- parametermanager/getParamVersion.js
- Retrieves the details of a specific parameter version.
- Takes projectId, parameterId, and versionId as input.
- Uses @google-cloud/parametermanager library to get the parameter version and prints its state and payload.
- parametermanager/listParamVersions.js
- Lists all versions of an existing parameter.
- Takes projectId and parameterId as input.
- Uses @google-cloud/parametermanager library to list the parameter versions and prints their state.
- parametermanager/listParams.js
- Lists all parameters in the global location.
- Takes projectId as input.
- Uses @google-cloud/parametermanager library to list the parameters and prints their name and format.
- parametermanager/package.json
- Adds dependencies for @google-cloud/parametermanager, @google-cloud/secret-manager, c8, chai, mocha, and uuid.
- Defines scripts for testing.
- parametermanager/renderParamVersion.js
- Retrieves and renders the details of a specific parameter version, resolving secret references.
- Takes projectId, parameterId, and parameterVersionId as input.
- Uses @google-cloud/parametermanager library to render the parameter version and prints the rendered payload.
- parametermanager/test/.eslintrc.yml
- Configures eslint for mocha tests
- parametermanager/test/parametermanager.test.js
- Adds tests for all the samples.
- Uses chai and child_process to execute the samples and assert the output.
- Creates temporary secrets and parameters for testing purposes.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and 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 to provide feedback.
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.
Trivia time!
What is the purpose of the 'uuid' library used in the tests?
Click here for the answer
The 'uuid' library is used to generate unique identifiers, which are used to create unique parameter and secret names for testing purposes, avoiding naming conflicts.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 samples for creating, listing, and rendering parameters and parameter versions using the Parameter Manager SDK. The samples cover various scenarios, including structured and unstructured data, referencing secrets, and retrieving parameter details. Overall, the code is well-structured and easy to follow. However, there are a few areas that could be improved for clarity and consistency.
Summary of Findings
- Copyright Year: The copyright year in the files is set to 2025. Please ensure this is the correct and intended year.
- Missing Tests: While the pull request includes a test file, it would be beneficial to have individual tests for each sample to ensure they function as expected and to prevent regressions.
- Inconsistent Parameter Version ID: The
parameterVersionId
is hardcoded as 'v1' in some samples. Consider generating a unique ID for each version to avoid conflicts.
Merge Readiness
The pull request introduces new functionality with sample code. While the code appears functional, the absence of individual tests for each sample raises concerns about long-term maintainability and reliability. Addressing the copyright year and adding more comprehensive tests would significantly improve the readiness of this pull request for merging. I am unable to directly approve the pull request, and recommend that others review and approve this code before merging.
@@ -0,0 +1,53 @@ | |||
// Copyright 2025 Google LLC |
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.
@@ -0,0 +1,75 @@ | |||
// Copyright 2025 Google LLC |
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.
@@ -0,0 +1,85 @@ | |||
// Copyright 2025 Google LLC |
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.
@@ -0,0 +1,69 @@ | |||
// Copyright 2025 Google LLC |
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.
@@ -0,0 +1,77 @@ | |||
// Copyright 2025 Google LLC |
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.
@vatsal-vora-crestdata The automated code comments here are valid: please update the copyright years since these are new samples |
I have added year as 2025 only, the comments are suggesting to change it back to 2023. I will update year in autogenerated workflow file to 2025 but for others it is 2025 only |
Description
Created samples for creating, listing and rendering parameter and parameter version
Added Sample List:
Checklist
npm test
(see Testing)npm run lint
(see Style)GoogleCloudPlatform/nodejs-docs-samples
. Not a fork.