-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add samples for secret expiration - create, update, and delete #10225
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?
Add samples for secret expiration - create, update, and delete #10225
Conversation
…ion key and deleting annotations from the secret
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary of ChangesHello @dhavalbhensdadiya-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 Secret Manager Java samples by introducing comprehensive examples for managing secret expiration, integrating with Customer-Managed Encryption Keys (CMEK), and handling resource tags. The new samples cover creation, modification, and deletion operations for secrets with expiration, creation of CMEK-protected secrets, and the full lifecycle of secret tags (bind, list, delete). These functionalities are demonstrated for both global and regional Secret Manager instances, ensuring broad applicability. The accompanying documentation and test suite have been updated to support these additions. 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 new code samples for Secret Manager, including binding and deleting secret tags, creating secrets with CMEK and expiration, deleting secret annotations and expiration, listing secret tag bindings, and updating secret expiration. It also includes regional versions of these samples. The README.md file is updated to include instructions for enabling the Cloud KMS API and setting environment variables for KMS keys. Review comments suggest correcting the copyright year to 2024, fixing a string literal split across two lines, rephrasing "KMS Keys (Global and Regional)" for clarity, and making multi-line comments more concise.
| private static final String ANNOTATION_KEY = | ||
| "exampleannotationkey"; |
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,74 @@ | |||
| /* | |||
| * Copyright 2026 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,66 @@ | |||
| /* | |||
| * Copyright 2026 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.
| // Initialize client that will be used to send requests. This client only needs | ||
| // to be created | ||
| // once, and can be reused for multiple requests. |
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.
This multi-line comment can be made more concise to improve readability. It's generally better to keep comments on a single line if possible.
| // Initialize client that will be used to send requests. This client only needs | |
| // to be created | |
| // once, and can be reused for multiple requests. | |
| // Initialize client that will be used to send requests. This client only needs to be created | |
| // once, and can be reused for multiple requests. |
| @@ -0,0 +1,77 @@ | |||
| /* | |||
| * Copyright 2026 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,74 @@ | |||
| /* | |||
| * Copyright 2026 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,66 @@ | |||
| /* | |||
| * Copyright 2026 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,90 @@ | |||
| /* | |||
| * Copyright 2026 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.
|
|
||
| // Initialize the client that will be used to send requests. This client only needs to be |
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.
This multi-line comment can be made more concise to improve readability. It's generally better to keep comments on a single line if possible.
| // Initialize the client that will be used to send requests. This client only needs to be | |
| // created once, and can be reused for multiple requests. |
| @@ -0,0 +1,64 @@ | |||
| /* | |||
| * Copyright 2026 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.
… secret expiration times
f5dfc54 to
15b8d11
Compare
… secret rotation policies and topics
Description
Added samples for below operations in global and regional scope:
Fixes #
Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.
Checklist
pom.xmlparent set to latestshared-configurationmvn clean verifyrequiredmvn -P lint checkstyle:checkrequiredmvn -P lint clean compile pmd:cpd-check spotbugs:checkadvisory only