Skip to content

Commit e3bc89e

Browse files
docs(samples): Update Region Tags (#1128)
1 parent 2b35e65 commit e3bc89e

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

samples/snippets/publisher.py

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

6262

63-
def create_topic_kinesis_ingestion(
63+
def create_topic_with_kinesis_ingestion(
6464
project_id: str,
6565
topic_id: str,
6666
stream_arn: str,
@@ -69,7 +69,7 @@ def create_topic_kinesis_ingestion(
6969
gcp_service_account: str,
7070
) -> None:
7171
"""Create a new Pub/Sub topic with AWS Kinesis Ingestion Settings."""
72-
# [START pubsub_create_topic_kinesis_ingestion]
72+
# [START pubsub_create_topic_with_kinesis_ingestion]
7373
from google.cloud import pubsub_v1
7474
from google.pubsub_v1.types import Topic
7575
from google.pubsub_v1.types import IngestionDataSourceSettings
@@ -100,10 +100,10 @@ def create_topic_kinesis_ingestion(
100100
topic = publisher.create_topic(request=request)
101101

102102
print(f"Created topic: {topic.name} with AWS Kinesis Ingestion Settings")
103-
# [END pubsub_create_topic_kinesis_ingestion]
103+
# [END pubsub_create_topic_with_kinesis_ingestion]
104104

105105

106-
def update_topic_kinesis_ingestion(
106+
def update_topic_type(
107107
project_id: str,
108108
topic_id: str,
109109
stream_arn: str,
@@ -112,7 +112,7 @@ def update_topic_kinesis_ingestion(
112112
gcp_service_account: str,
113113
) -> None:
114114
"""Update Pub/Sub topic with AWS Kinesis Ingestion Settings."""
115-
# [START pubsub_update_topic_kinesis_ingestion]
115+
# [START pubsub_update_topic_type]
116116
from google.cloud import pubsub_v1
117117
from google.pubsub_v1.types import Topic
118118
from google.pubsub_v1.types import IngestionDataSourceSettings
@@ -149,7 +149,7 @@ def update_topic_kinesis_ingestion(
149149
print(f"Updated topic: {topic.name} with AWS Kinesis Ingestion Settings")
150150

151151

152-
# [END pubsub_update_topic_kinesis_ingestion]
152+
# [END pubsub_update_topic_type]
153153

154154

155155
def delete_topic(project_id: str, topic_id: str) -> None:
@@ -522,23 +522,23 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
522522
create_parser = subparsers.add_parser("create", help=create_topic.__doc__)
523523
create_parser.add_argument("topic_id")
524524

525-
create_topic_kinesis_ingestion_parser = subparsers.add_parser(
526-
"create_kinesis_ingestion", help=create_topic_kinesis_ingestion.__doc__
525+
create_topic_with_kinesis_ingestion_parser = subparsers.add_parser(
526+
"create_kinesis_ingestion", help=create_topic_with_kinesis_ingestion.__doc__
527527
)
528-
create_topic_kinesis_ingestion_parser.add_argument("topic_id")
529-
create_topic_kinesis_ingestion_parser.add_argument("stream_arn")
530-
create_topic_kinesis_ingestion_parser.add_argument("consumer_arn")
531-
create_topic_kinesis_ingestion_parser.add_argument("aws_role_arn")
532-
create_topic_kinesis_ingestion_parser.add_argument("gcp_service_account")
533-
534-
update_topic_kinesis_ingestion_parser = subparsers.add_parser(
535-
"update_kinesis_ingestion", help=update_topic_kinesis_ingestion.__doc__
528+
create_topic_with_kinesis_ingestion_parser.add_argument("topic_id")
529+
create_topic_with_kinesis_ingestion_parser.add_argument("stream_arn")
530+
create_topic_with_kinesis_ingestion_parser.add_argument("consumer_arn")
531+
create_topic_with_kinesis_ingestion_parser.add_argument("aws_role_arn")
532+
create_topic_with_kinesis_ingestion_parser.add_argument("gcp_service_account")
533+
534+
update_topic_type_parser = subparsers.add_parser(
535+
"update_kinesis_ingestion", help=update_topic_type.__doc__
536536
)
537-
update_topic_kinesis_ingestion_parser.add_argument("topic_id")
538-
update_topic_kinesis_ingestion_parser.add_argument("stream_arn")
539-
update_topic_kinesis_ingestion_parser.add_argument("consumer_arn")
540-
update_topic_kinesis_ingestion_parser.add_argument("aws_role_arn")
541-
update_topic_kinesis_ingestion_parser.add_argument("gcp_service_account")
537+
update_topic_type_parser.add_argument("topic_id")
538+
update_topic_type_parser.add_argument("stream_arn")
539+
update_topic_type_parser.add_argument("consumer_arn")
540+
update_topic_type_parser.add_argument("aws_role_arn")
541+
update_topic_type_parser.add_argument("gcp_service_account")
542542

543543
delete_parser = subparsers.add_parser("delete", help=delete_topic.__doc__)
544544
delete_parser.add_argument("topic_id")
@@ -601,7 +601,7 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
601601
elif args.command == "create":
602602
create_topic(args.project_id, args.topic_id)
603603
elif args.command == "create_kinesis_ingestion":
604-
create_topic_kinesis_ingestion(
604+
create_topic_with_kinesis_ingestion(
605605
args.project_id,
606606
args.topic_id,
607607
args.stream_arn,
@@ -610,7 +610,7 @@ def detach_subscription(project_id: str, subscription_id: str) -> None:
610610
args.gcp_service_account,
611611
)
612612
elif args.command == "update_kinesis_ingestion":
613-
update_topic_kinesis_ingestion(
613+
update_topic_type(
614614
args.project_id,
615615
args.topic_id,
616616
args.stream_arn,

samples/snippets/publisher_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def test_create(
127127
publisher_client.delete_topic(request={"topic": topic_path})
128128

129129

130-
def test_create_kinesis_ingestion(
130+
def test_create_topic_with_kinesis_ingestion(
131131
publisher_client: pubsub_v1.PublisherClient, capsys: CaptureFixture[str]
132132
) -> None:
133133
# The scope of `topic_path` is limited to this function.
@@ -146,7 +146,7 @@ def test_create_kinesis_ingestion(
146146
except NotFound:
147147
pass
148148

149-
publisher.create_topic_kinesis_ingestion(
149+
publisher.create_topic_with_kinesis_ingestion(
150150
PROJECT_ID,
151151
TOPIC_ID,
152152
stream_arn,
@@ -162,7 +162,7 @@ def test_create_kinesis_ingestion(
162162
publisher_client.delete_topic(request={"topic": topic_path})
163163

164164

165-
def test_update_kinesis_ingestion(
165+
def test_update_topic_type(
166166
publisher_client: pubsub_v1.PublisherClient, capsys: CaptureFixture[str]
167167
) -> None:
168168
# The scope of `topic_path` is limited to this function.
@@ -186,7 +186,7 @@ def test_update_kinesis_ingestion(
186186
out, _ = capsys.readouterr()
187187
assert f"Created topic: {topic_path}" in out
188188

189-
publisher.update_topic_kinesis_ingestion(
189+
publisher.update_topic_type(
190190
PROJECT_ID,
191191
TOPIC_ID,
192192
stream_arn,

0 commit comments

Comments
 (0)