Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 888fae1

Browse files
1 parent 72d4691 commit 888fae1

2 files changed

Lines changed: 19 additions & 8 deletions

File tree

samples/snippets/publisher.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,14 @@ def create_topic(project_id: str, topic_id: str) -> None:
6060
# [END pubsub_create_topic]
6161

6262

63-
def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: str,
64-
consumer_arn: str, aws_role_arn: str, gcp_service_account: str) -> None:
63+
def create_topic_kinesis_ingestion(
64+
project_id: str,
65+
topic_id: str,
66+
stream_arn: str,
67+
consumer_arn: str,
68+
aws_role_arn: str,
69+
gcp_service_account: str,
70+
) -> None:
6571
"""Create a new Pub/Sub topic with AWS Kinesis Ingestion Settings."""
6672
# [START pubsub_quickstart_create_topic]
6773
# [START pubsub_create_topic]
@@ -89,7 +95,7 @@ def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: s
8995
aws_role_arn=aws_role_arn,
9096
gcp_service_account=gcp_service_account,
9197
)
92-
)
98+
),
9399
)
94100

95101
topic = publisher.create_topic(request=request)
@@ -469,7 +475,9 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
469475
create_parser = subparsers.add_parser("create", help=create_topic.__doc__)
470476
create_parser.add_argument("topic_id")
471477

472-
create_topic_kinesis_ingestion_parser = subparsers.add_parser("create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__)
478+
create_topic_kinesis_ingestion_parser = subparsers.add_parser(
479+
"create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__
480+
)
473481
create_topic_kinesis_ingestion_parser.add_argument("topic_id")
474482
create_topic_kinesis_ingestion_parser.add_argument("stream_arn")
475483
create_topic_kinesis_ingestion_parser.add_argument("consumer_arn")
@@ -543,7 +551,7 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
543551
args.stream_arn,
544552
args.consumer_arn,
545553
args.aws_role_arn,
546-
args.gcp_service_account
554+
args.gcp_service_account,
547555
)
548556
elif args.command == "delete":
549557
delete_topic(args.project_id, args.topic_id)

samples/snippets/publisher_test.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,9 @@ def test_create_kinesis_ingestion(
135135
stream_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"
136136
consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111"
137137
aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name"
138-
gcp_service_account = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com"
138+
gcp_service_account = (
139+
"fake-service-account@fake-gcp-project.iam.gserviceaccount.com"
140+
)
139141

140142
try:
141143
publisher_client.delete_topic(request={"topic": topic_path})
@@ -148,12 +150,13 @@ def test_create_kinesis_ingestion(
148150
stream_arn,
149151
consumer_arn,
150152
aws_role_arn,
151-
gcp_service_account
152-
)
153+
gcp_service_account,
154+
)
153155

154156
out, _ = capsys.readouterr()
155157
assert f"Created topic: {topic_path} with AWS Kinesis Ingestion Settings" in out
156158

159+
157160
def test_list(topic_path: str, capsys: CaptureFixture[str]) -> None:
158161
publisher.list_topics(PROJECT_ID)
159162
out, _ = capsys.readouterr()

0 commit comments

Comments
 (0)