Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Mar 13, 2024
1 parent 72d4691 commit 888fae1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
18 changes: 13 additions & 5 deletions samples/snippets/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@ def create_topic(project_id: str, topic_id: str) -> None:
# [END pubsub_create_topic]


def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: str,
consumer_arn: str, aws_role_arn: str, gcp_service_account: str) -> None:
def create_topic_kinesis_ingestion(
project_id: str,
topic_id: str,
stream_arn: str,
consumer_arn: str,
aws_role_arn: str,
gcp_service_account: str,
) -> None:
"""Create a new Pub/Sub topic with AWS Kinesis Ingestion Settings."""
# [START pubsub_quickstart_create_topic]
# [START pubsub_create_topic]
Expand Down Expand Up @@ -89,7 +95,7 @@ def create_topic_kinesis_ingestion(project_id: str, topic_id: str, stream_arn: s
aws_role_arn=aws_role_arn,
gcp_service_account=gcp_service_account,
)
)
),
)

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

create_topic_kinesis_ingestion_parser = subparsers.add_parser("create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__)
create_topic_kinesis_ingestion_parser = subparsers.add_parser(
"create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__
)
create_topic_kinesis_ingestion_parser.add_argument("topic_id")
create_topic_kinesis_ingestion_parser.add_argument("stream_arn")
create_topic_kinesis_ingestion_parser.add_argument("consumer_arn")
Expand Down Expand Up @@ -543,7 +551,7 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
args.stream_arn,
args.consumer_arn,
args.aws_role_arn,
args.gcp_service_account
args.gcp_service_account,
)
elif args.command == "delete":
delete_topic(args.project_id, args.topic_id)
Expand Down
9 changes: 6 additions & 3 deletions samples/snippets/publisher_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ def test_create_kinesis_ingestion(
stream_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"
consumer_arn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111"
aws_role_arn = "arn:aws:iam::111111111111:role/fake-role-name"
gcp_service_account = "[email protected]"
gcp_service_account = (
"[email protected]"
)

try:
publisher_client.delete_topic(request={"topic": topic_path})
Expand All @@ -148,12 +150,13 @@ def test_create_kinesis_ingestion(
stream_arn,
consumer_arn,
aws_role_arn,
gcp_service_account
)
gcp_service_account,
)

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


def test_list(topic_path: str, capsys: CaptureFixture[str]) -> None:
publisher.list_topics(PROJECT_ID)
out, _ = capsys.readouterr()
Expand Down

0 comments on commit 888fae1

Please sign in to comment.