-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add MessageTransform field to 'google_pubsub_subscription' #13203
base: main
Are you sure you want to change the base?
Add MessageTransform field to 'google_pubsub_subscription' #13203
Conversation
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 @abbrowne126, 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
I am currently reviewing this pull request. In the meantime, I'm providing a summary of the changes for you and other reviewers to quickly understand the changes and the intent behind them. This pull request adds the message_transform
field to the google_pubsub_subscription
resource. This allows users to apply transformations to messages published to a topic before they are delivered to subscribers. The transforms are applied in the order specified. The pull request includes changes to the Subscription.yaml
file to define the new field and its properties, adds a new example in pubsub_subscription_javascript_udf.tf.tmpl
to demonstrate the usage of the message_transforms
field with a JavaScript UDF, and adds a new test case TestAccPubsubSubscription_javascriptUdfUpdate
in resource_pubsub_subscription_test.go
to verify the functionality.
Highlights
- New Feature: Message Transforms: Introduces the
message_transforms
field to thegoogle_pubsub_subscription
resource, enabling message transformations before delivery to subscribers. - JavaScript UDF Support: Adds support for JavaScript User Defined Functions (UDFs) within message transforms, allowing custom message manipulation using JavaScript code.
- Example Usage: Provides a Terraform example demonstrating how to use the
message_transforms
field with a JavaScript UDF to filter messages. - Testing: Includes a new test case to verify the functionality of updating a subscription with a JavaScript UDF.
Changelog
Click here to see the changelog
- mmv1/products/pubsub/Subscription.yaml
- Added
messageTransforms
property to thegoogle_pubsub_subscription
resource. - Defined the structure for
messageTransforms
, includingjavascriptUdf
(withfunctionName
andcode
) andenabled
properties. - Added descriptions for each property within
messageTransforms
to explain their purpose and usage.
- Added
- mmv1/templates/terraform/examples/pubsub_subscription_javascript_udf.tf.tmpl
- Created a new Terraform example demonstrating the usage of
message_transforms
with a JavaScript UDF. - The example defines a
google_pubsub_topic
and agoogle_pubsub_subscription
with amessage_transforms
block. - The JavaScript UDF in the example filters falsy messages.
- Created a new Terraform example demonstrating the usage of
- mmv1/third_party/terraform/services/pubsub/resource_pubsub_subscription_test.go
- Added a new test case
TestAccPubsubSubscription_javascriptUdfUpdate
to verify the functionality of updating a subscription with a JavaScript UDF. - The test case creates a topic and a subscription with a JavaScript UDF, then updates the subscription.
- Added helper function
testAccPubsubSubscription_updateWithUpdatedJavascriptUdfSettings
to define the Terraform configuration for the test case.
- Added a new test case
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 message flows, a journey starts,
Transforms applied, playing their parts.
With JavaScript's grace,
It finds its place,
A Pub/Sub tale of clever arts.
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 code changes introduce the message_transforms
field to the google_pubsub_subscription
resource. The addition of this feature seems well-structured, and the provided example and test case are helpful. I've left a suggestion for improvement regarding a duplicated field in the test configuration.
Summary of Findings
- Duplicated
name
field in test configuration: Thename
field is defined twice in thegoogle_pubsub_subscription
resource within the test configuration. This redundancy should be removed to ensure the configuration is valid and functions as expected.
Assessment
The code changes introduce the message_transforms
field to the google_pubsub_subscription
resource, allowing users to apply transformations to messages published to the topic. The addition of this feature seems well-structured, and the provided example and test case are helpful. However, there's a potential issue in the test case where the name
field is duplicated. I would recommend addressing this comment before requesting a review from someone else, but feel free to request another review from Gemini via /gemini review
when you have addressed these comments and I'll take another look! Note that in any circumstance, users should have others review and approve this code before merging.
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
Release Note Template for Downstream PRs (will be copied)
See Write release notes for guidance.
Add MessageTransform field to
google-pubsub-topic
. Mirrors #12969.