Skip to content

feat(PubSub): Add update_topic_type sample #2098

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

Merged
merged 4 commits into from
Jun 9, 2025

Conversation

cy-yun
Copy link
Contributor

@cy-yun cy-yun commented Jun 2, 2025

b/322221088

@cy-yun cy-yun requested review from a team as code owners June 2, 2025 22:40
Copy link

snippet-bot bot commented Jun 2, 2025

Here is the summary of changes.

You are about to add 1 region tag.

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 api: pubsub Issues related to the Pub/Sub API. samples Issues that are directly related to samples. labels Jun 2, 2025
@cy-yun cy-yun force-pushed the update-topic-type branch from 6529cee to b355593 Compare June 3, 2025 22:16
Comment on lines 52 to 65
$topic = $pubsub->topic($topicName, [
'ingestionDataSourceSettings' => [
'aws_kinesis' => [
'stream_arn' => $streamArn,
'consumer_arn' => $consumerArn,
'aws_role_arn' => $awsRoleArn,
'gcp_service_account' => $gcpServiceAccount
]
]
]);

$topic->update([], [
'updateMask' => [ 'ingestionDataSourceSettings' ]
]);
Copy link
Contributor

@bshaffer bshaffer Jun 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valid way to do it, but I think when updating, the API would normally look a bit more like this:

Suggested change
$topic = $pubsub->topic($topicName, [
'ingestionDataSourceSettings' => [
'aws_kinesis' => [
'stream_arn' => $streamArn,
'consumer_arn' => $consumerArn,
'aws_role_arn' => $awsRoleArn,
'gcp_service_account' => $gcpServiceAccount
]
]
]);
$topic->update([], [
'updateMask' => [ 'ingestionDataSourceSettings' ]
]);
$topic = $pubsub->topic($topicName);
$topic->update([
'ingestionDataSourceSettings' => [
'aws_kinesis' => [
'stream_arn' => $streamArn,
'consumer_arn' => $consumerArn,
'aws_role_arn' => $awsRoleArn,
'gcp_service_account' => $gcpServiceAccount
]
]
], [
'updateMask' => [
'ingestionDataSourceSettings'
]
]);
@bshaffer bshaffer merged commit 7dd8e32 into GoogleCloudPlatform:main Jun 9, 2025
4 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. samples Issues that are directly related to samples.
2 participants