-
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 samples to delete, enable and disable parameter versions in both region and global #4014
base: main
Are you sure you want to change the base?
Conversation
…am in both global and regional
…samples-update-delete
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 deleting, enabling, and disabling parameter versions in both regional and global contexts using the Google Cloud Parameter Manager. It also includes quickstart examples for both global and regional parameter management. The changes include the addition of new files containing the sample code and a modification to the workflow configuration to include the new samples.
Highlights
- New Samples: Adds samples for deleting parameters, disabling parameter versions, enabling disabled parameter versions, and deleting parameter versions, covering both global and regional scenarios.
- Workflow Configuration: Updates the
.github/workflows/parametermanager.yaml
file to include the new samples in the CI/CD pipeline. - Quickstart Examples: Includes quickstart examples demonstrating basic parameter management operations for both global and regional setups.
Changelog
Click here to see the changelog
- .github/workflows/parametermanager.yaml
- Added a new workflow configuration file for Parameter Manager to automate testing and flaky bot checks.
- .github/workflows/utils/workflows.json
- Added 'parametermanager' to the list of workflows to be executed.
- parametermanager/deleteParam.js
- Created a new sample to delete a parameter from the global location of a specified project.
- Implements the
deleteParam
function to delete the parameter using the Parameter Manager client library.
- parametermanager/deleteParamVersion.js
- Created a new sample to delete a specific version of a parameter in the global location.
- Implements the
deleteParamVersion
function to delete the parameter version using the Parameter Manager client library.
- parametermanager/disableParamVersion.js
- Created a new sample to disable a specific version of a global parameter.
- Implements the
disableParamVersion
function to update the parameter version'sdisabled
field to true.
- parametermanager/enableParamVersion.js
- Created a new sample to enable a specific version of a global parameter.
- Implements the
enableParamVersion
function to update the parameter version'sdisabled
field to false.
- parametermanager/package.json
- Added a new
package.json
file for the Parameter Manager samples. - Includes dependencies such as
@google-cloud/parametermanager
,@google-cloud/secret-manager
,c8
,chai
,mocha
, anduuid
.
- Added a new
- parametermanager/quickstart.js
- Created a new quickstart sample for global parameter management.
- Demonstrates creating a parameter, creating a parameter version, viewing the parameter version, and rendering its payload.
- parametermanager/regional_samples/deleteRegionalParam.js
- Created a new sample to delete a parameter from a specified region.
- Implements the
deleteRegionalParam
function to delete the regional parameter using the Parameter Manager client library.
- parametermanager/regional_samples/deleteRegionalParamVersion.js
- Created a new sample to delete a specific version of a parameter in a specified region.
- Implements the
deleteRegionalParamVersion
function to delete the regional parameter version using the Parameter Manager client library.
- parametermanager/regional_samples/disableRegionalParamVersion.js
- Created a new sample to disable a specific version of a regional parameter.
- Implements the
disableRegionalParamVersion
function to update the regional parameter version'sdisabled
field to true.
- parametermanager/regional_samples/enableRegionalParamVersion.js
- Created a new sample to enable a specific version of a regional parameter.
- Implements the
enableRegionalParamVersion
function to update the regional parameter version'sdisabled
field to false.
- parametermanager/regional_samples/regionalQuickstart.js
- Created a new quickstart sample for regional parameter management.
- Demonstrates creating a regional parameter, creating a parameter version, viewing the parameter version, and rendering its payload.
- parametermanager/test/.eslintrc.yml
- Added a new
.eslintrc.yml
file for the Parameter Manager tests. - Configures the environment for Mocha testing.
- Added a new
- parametermanager/test/parametermanager.test.js
- Created a new test file for the Parameter Manager samples.
- Includes tests for the quickstart, regional quickstart, enable/disable parameter versions, and delete parameter/parameter versions.
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.
In the realm of parameters, versions reside,
Managed with care, where code does confide.
Enable, disable, delete with grace,
In cloud's vast space, find your place.
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
This pull request introduces samples for deleting, enabling, and disabling parameter versions in both regional and global contexts. The addition of quickstart examples for both global and regional configurations enhances the usability of the Parameter Manager. The code is generally well-structured and follows a consistent pattern across the different samples.
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 Error Handling: The samples lack explicit error handling for API calls. Adding error checks would improve the robustness of the samples.
- Inconsistent Parameter Usage: There are inconsistencies in how parameters are passed and used across different samples, particularly in the regional samples. Standardizing this would improve clarity.
Merge Readiness
The pull request introduces valuable samples for managing parameters and their versions in both global and regional contexts. However, before merging, it's recommended to address the copyright year, incorporate error handling, and standardize parameter usage across the samples. I am unable to approve this pull request, and recommend that others review and approve this code before merging.
@@ -0,0 +1,55 @@ | |||
// 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,67 @@ | |||
// 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,80 @@ | |||
// 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,80 @@ | |||
// 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,97 @@ | |||
// 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.
await client.deleteParameterVersion({ | ||
name: name, | ||
}); |
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.
// Make the API call to update the parameter version | ||
const [response] = await client.updateParameterVersion(request); | ||
|
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.
Consider adding error handling to the API call to improve the robustness of the sample.
// Make the API call to update the parameter version | |
const [response] = await client.updateParameterVersion(request); | |
try { | |
const [response] = await client.updateParameterVersion(request); | |
return response; | |
} catch (err) { | |
console.error(`Failed to disable regional parameter version: ${err}`); | |
throw err; | |
} |
// Make the API call to update the parameter version | ||
const [response] = await client.updateParameterVersion(request); | ||
|
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.
Consider adding error handling to the API call to improve the robustness of the sample.
// Make the API call to update the parameter version | |
const [response] = await client.updateParameterVersion(request); | |
try { | |
const [response] = await client.updateParameterVersion(request); | |
return response; | |
} catch (err) { | |
console.error(`Failed to enable regional parameter version: ${err}`); | |
throw err; | |
} |
// Create a new parameter | ||
const [parameter] = await client.createParameter(parameterRequest); | ||
console.log( |
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.
Consider adding error handling to the API call to improve the robustness of the sample.
try {
const [parameter] = await client.createParameter(parameterRequest);
console.log(
`Created regional parameter ${parameter.name} with format ${parameter.format}`
);
} catch (err) {
console.error(`Failed to create regional parameter: ${err}`);
throw err;
}
const [response] = await client.getParameterVersion({ | ||
name: parameterVersion.name, | ||
}); | ||
console.log(`Retrieved regional parameter version: ${response.name}`); | ||
console.log('Payload:', response.payload.data.toString('utf8')); |
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.
Consider adding error handling to the API call to improve the robustness of the sample.
try {
const [response] = await client.getParameterVersion({
name: parameterVersion.name,
});
console.log(`Retrieved regional parameter version: ${response.name}`);
console.log('Payload:', response.payload.data.toString('utf8'));
} catch (err) {
console.error(`Failed to get regional parameter version: ${err}`);
throw err;
}
Description
Created samples for deleting, enabling and disabling parameter and parameter version in both regional and global. Also added quickstart examples for both global and regional
Added Sample List:
Checklist
npm test
(see Testing)npm run lint
(see Style)us-central1
GoogleCloudPlatform/nodejs-docs-samples
. Not a fork.