-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(parametermanager): Added samples for delete, enable and disable parameter and parameter version #5253
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 for delete, enable and disable parameter and parameter version #5253
Conversation
Here is the summary of changes. You are about to add 4 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 @durgesh-ninave-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!
Summary of Changes
This pull request introduces new samples for the Parameter Manager SDK, specifically focusing on deleting parameters, deleting parameter versions, disabling parameter versions, and enabling disabled parameter versions. The changes include the addition of four new Go files, each implementing one of these functionalities. Additionally, a test file has been added to verify the correct behavior of these new functions. The go.mod and go.sum files have also been updated to reflect the new dependencies and versions.
Highlights
- New Samples: Added four new samples demonstrating how to delete a parameter, delete a parameter version, disable a parameter version, and enable a disabled parameter version using the Parameter Manager SDK.
- Test Coverage: Included a new test file,
parametermanager_test.go
, to ensure the new functions operate as expected, covering the core functionalities of the added samples. - Dependency Updates: Updated
go.mod
andgo.sum
to include necessary dependencies and reflect the new Go version (1.23.0) and toolchain (go1.23.4).
Changelog
Click here to see the changelog
- parametermanager/delete_param.go
- Added a new function
deleteParam
that deletes a parameter using the Parameter Manager SDK. - Includes error handling for client creation and parameter deletion failures.
- Prints a success message to the provided io.Writer upon successful deletion.
- Added a new function
- parametermanager/delete_param_version.go
- Added a new function
deleteParamVersion
that deletes a specific version of a parameter. - Includes error handling for client creation and parameter version deletion failures.
- Prints a success message to the provided io.Writer upon successful deletion.
- Added a new function
- parametermanager/disable_param_vesion.go
- Added a new function
disableParamVersion
that disables a specific version of a parameter. - Uses
UpdateParameterVersion
to set theDisabled
field to true. - Includes error handling for client creation and parameter version update failures.
- Prints a success message to the provided io.Writer upon successful disabling.
- Added a new function
- parametermanager/enable_param_version.go
- Added a new function
enableParamVersion
that enables a disabled parameter version. - Uses
UpdateParameterVersion
to set theDisabled
field to false. - Includes error handling for client creation and parameter version update failures.
- Prints a success message to the provided io.Writer upon successful enabling.
- Added a new function
- parametermanager/go.mod
- Updated the Go version to 1.23.0 and added a toolchain version of go1.23.4.
- Added
github.com/GoogleCloudPlatform/golang-samples
andgithub.com/gofrs/uuid
as required modules. - Updated versions of
google.golang.org/genproto
andgoogle.golang.org/grpc
. - Added several indirect dependencies related to opentelemetry and googleapis.
- parametermanager/go.sum
- Added checksums for the new and updated dependencies in
go.mod
.
- Added checksums for the new and updated dependencies in
- parametermanager/parametermanager_test.go
- Added a new test file to verify the functionality of the new sample functions.
- Includes helper functions for creating and cleaning up parameters and parameter versions for testing purposes.
- Tests the
disableParamVersion
,enableParamVersion
,deleteParam
, anddeleteParamVersion
functions.
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.
A parameter's life,
A version's rise and fall,
Code's gentle control.
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 new samples for deleting, enabling, and disabling parameters and parameter versions using the Parameter Manager SDK. The code includes the necessary tests, which is great. Here are some suggestions for improvements.
Summary of Findings
- Error message consistency: The error messages in the new functions are slightly inconsistent. Standardizing the error message format would improve maintainability.
- Redundant defer calls in tests: The tests include redundant defer calls to cleanup functions. Removing these would simplify the test code.
Merge Readiness
The code changes are well-structured and include tests. However, addressing the error message consistency and redundant defer calls would improve the overall quality. I am unable to directly approve this pull request, and recommend that another reviewer approve this code before merging. I recommend that the pull request not be merged until the high severity issues are addressed.
if err != nil { | ||
return fmt.Errorf("failed to delete parameter: %w", err) | ||
} |
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.
return fmt.Errorf("failed to delete parameter version: %w", err) | ||
} |
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 including the parameter version name in the error message for better context.
How about: return fmt.Errorf("failed to delete parameter version %s: %w", name, err)
return fmt.Errorf("failed to delete parameter version: %w", err) | |
} | |
return fmt.Errorf("failed to delete parameter version %s: %w", name, err) |
if _, err := client.UpdateParameterVersion(ctx, req); err != nil { | ||
return fmt.Errorf("failed to disable parameter version: %w", err) |
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.
if _, err := client.UpdateParameterVersion(ctx, req); err != nil { | ||
return fmt.Errorf("failed to enable parameter version: %w", err) |
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.
Please run go mod tidy and relevant commands to fix Go/Lint
|
code-assist input not useful
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
Description
Added samples for deleting parameter, enabling, disabling and deleting parameter version using Parameter manager SDK
Sample List (global):
Added required tests for it.
Checklist
go test -v ./..
(see Testing)gofmt
(see Formatting)go vet
(see Formatting)