Skip to content

Comments

feat(cloudkms): add samples for CryptoKey/CryptoKeyVersion deletion and get/lists RetiredResources#13852

Open
yasharel wants to merge 2 commits intoGoogleCloudPlatform:mainfrom
yasharel:delete-key-samples-python
Open

feat(cloudkms): add samples for CryptoKey/CryptoKeyVersion deletion and get/lists RetiredResources#13852
yasharel wants to merge 2 commits intoGoogleCloudPlatform:mainfrom
yasharel:delete-key-samples-python

Conversation

@yasharel
Copy link
Member

@yasharel yasharel commented Feb 20, 2026

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

@yasharel yasharel requested review from a team as code owners February 20, 2026 20:33
@product-auto-label product-auto-label bot added the api: cloudkms Issues related to the Cloud Key Management Service API. label Feb 20, 2026
@snippet-bot
Copy link

snippet-bot bot commented Feb 20, 2026

Here is the summary of changes.

You are about to add 4 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Feb 20, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @yasharel, 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 enhances the Google Cloud Key Management Service (KMS) Python samples by introducing new functionalities for resource lifecycle management. It provides practical examples for deleting CryptoKeys and CryptoKeyVersions, and for querying retired resources. Additionally, the PR updates the core KMS client library dependency and includes a new test case to ensure the reliability of these new features.

Highlights

  • New KMS Deletion Samples: Added new Python samples for deleting a Cloud KMS CryptoKey and a CryptoKeyVersion.
  • New KMS Retired Resources Samples: Introduced new Python samples to get and list retired resources within Cloud KMS.
  • Dependency Update: Updated the google-cloud-kms client library version to 3.11.0.
  • New Test Coverage: Added a new integration test to validate the functionality of key deletion and the subsequent management of retired resources.
Changelog
  • kms/snippets/delete_key.py
    • Added a new Python sample demonstrating how to delete a CryptoKey.
  • kms/snippets/delete_key_version.py
    • Added a new Python sample demonstrating how to delete a CryptoKeyVersion.
  • kms/snippets/get_retired_resource.py
    • Added a new Python sample demonstrating how to retrieve a specific retired resource.
  • kms/snippets/list_retired_resources.py
    • Added a new Python sample demonstrating how to list all retired resources for a given location.
  • kms/snippets/requirements.txt
    • Updated the google-cloud-kms library version from 3.2.1 to 3.11.0.
  • kms/snippets/snippets_test.py
    • Imported the newly added delete_key, list_retired_resources, and get_retired_resource functions.
    • Added a new test function test_delete_key_and_retired_resources to verify the deletion of a key and the subsequent listing and retrieval of its retired resource entry.
Activity
  • The author has confirmed adherence to the Sample Guidelines from AUTHORING_GUIDE.MD.
  • The README has been updated to reflect the changes.
  • All tests (nox -s py-3.9) have passed.
  • Lint checks (nox -s lint) have passed.
  • The author has requested the PR to be merged upon approval.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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

  1. 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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 new samples for Cloud KMS to demonstrate key deletion and handling of retired resources. The changes are generally good, but I've found a critical bug in the list_retired_resources sample that would cause it to always return an empty list. I've also pointed out several inconsistencies in the docstrings of the new samples that should be addressed for clarity and consistency. Lastly, the new delete_key_version sample is missing test coverage, which should be added.

@yasharel yasharel marked this pull request as draft February 20, 2026 21:13
@yasharel yasharel force-pushed the delete-key-samples-python branch 5 times, most recently from ada813d to 5ef3b5d Compare February 20, 2026 21:53
@yasharel yasharel force-pushed the delete-key-samples-python branch from 5ef3b5d to 2f06912 Compare February 20, 2026 21:55
@yasharel yasharel marked this pull request as ready for review February 20, 2026 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: cloudkms Issues related to the Cloud Key Management Service API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant