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

Commit aa3754c

Browse files
chore: use gapic-generator-python 0.63.1 (#575)
- [x] Regenerate this pull request now. docs: add autogenerated code snippets PiperOrigin-RevId: 426256923 Source-Link: googleapis/googleapis@9ebabfa Source-Link: googleapis/googleapis-gen@a881752 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYTg4MTc1MjYzZTYwYTFkNDVkM2E0NDc4NDg2NTJiMGY2NzBiMmNiOCJ9
1 parent c48fb8c commit aa3754c

70 files changed

Lines changed: 6782 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

google/pubsub_v1/services/publisher/async_client.py

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,26 @@ async def create_topic(
220220
name rules]
221221
(https://cloud.google.com/pubsub/docs/admin#resource_names).
222222
223+
224+
.. code-block::
225+
226+
from google import pubsub_v1
227+
228+
def sample_create_topic():
229+
# Create a client
230+
client = pubsub_v1.PublisherClient()
231+
232+
# Initialize request argument(s)
233+
request = pubsub_v1.Topic(
234+
name="name_value",
235+
)
236+
237+
# Make the request
238+
response = client.create_topic(request=request)
239+
240+
# Handle response
241+
print(response)
242+
223243
Args:
224244
request (Union[google.pubsub_v1.types.Topic, dict]):
225245
The request object. A topic resource.
@@ -304,6 +324,29 @@ async def update_topic(
304324
r"""Updates an existing topic. Note that certain
305325
properties of a topic are not modifiable.
306326
327+
328+
.. code-block::
329+
330+
from google import pubsub_v1
331+
332+
def sample_update_topic():
333+
# Create a client
334+
client = pubsub_v1.PublisherClient()
335+
336+
# Initialize request argument(s)
337+
topic = pubsub_v1.Topic()
338+
topic.name = "name_value"
339+
340+
request = pubsub_v1.UpdateTopicRequest(
341+
topic=topic,
342+
)
343+
344+
# Make the request
345+
response = client.update_topic(request=request)
346+
347+
# Handle response
348+
print(response)
349+
307350
Args:
308351
request (Union[google.pubsub_v1.types.UpdateTopicRequest, dict]):
309352
The request object. Request for the UpdateTopic method.
@@ -365,6 +408,26 @@ async def publish(
365408
r"""Adds one or more messages to the topic. Returns ``NOT_FOUND`` if
366409
the topic does not exist.
367410
411+
412+
.. code-block::
413+
414+
from google import pubsub_v1
415+
416+
def sample_publish():
417+
# Create a client
418+
client = pubsub_v1.PublisherClient()
419+
420+
# Initialize request argument(s)
421+
request = pubsub_v1.PublishRequest(
422+
topic="topic_value",
423+
)
424+
425+
# Make the request
426+
response = client.publish(request=request)
427+
428+
# Handle response
429+
print(response)
430+
368431
Args:
369432
request (Union[google.pubsub_v1.types.PublishRequest, dict]):
370433
The request object. Request for the Publish method.
@@ -457,6 +520,25 @@ async def get_topic(
457520
) -> pubsub.Topic:
458521
r"""Gets the configuration of a topic.
459522
523+
.. code-block::
524+
525+
from google import pubsub_v1
526+
527+
def sample_get_topic():
528+
# Create a client
529+
client = pubsub_v1.PublisherClient()
530+
531+
# Initialize request argument(s)
532+
request = pubsub_v1.GetTopicRequest(
533+
topic="topic_value",
534+
)
535+
536+
# Make the request
537+
response = client.get_topic(request=request)
538+
539+
# Handle response
540+
print(response)
541+
460542
Args:
461543
request (Union[google.pubsub_v1.types.GetTopicRequest, dict]):
462544
The request object. Request for the GetTopic method.
@@ -537,6 +619,24 @@ async def list_topics(
537619
) -> pagers.ListTopicsAsyncPager:
538620
r"""Lists matching topics.
539621
622+
.. code-block::
623+
624+
from google import pubsub_v1
625+
626+
def sample_list_topics():
627+
# Create a client
628+
client = pubsub_v1.PublisherClient()
629+
630+
# Initialize request argument(s)
631+
request = pubsub_v1.ListTopicsRequest(
632+
project="project_value",
633+
)
634+
635+
# Make the request
636+
page_result = client.list_topics(request=request)
637+
for response in page_result:
638+
print(response)
639+
540640
Args:
541641
request (Union[google.pubsub_v1.types.ListTopicsRequest, dict]):
542642
The request object. Request for the `ListTopics` method.
@@ -628,6 +728,25 @@ async def list_topic_subscriptions(
628728
r"""Lists the names of the attached subscriptions on this
629729
topic.
630730
731+
732+
.. code-block::
733+
734+
from google import pubsub_v1
735+
736+
def sample_list_topic_subscriptions():
737+
# Create a client
738+
client = pubsub_v1.PublisherClient()
739+
740+
# Initialize request argument(s)
741+
request = pubsub_v1.ListTopicSubscriptionsRequest(
742+
topic="topic_value",
743+
)
744+
745+
# Make the request
746+
page_result = client.list_topic_subscriptions(request=request)
747+
for response in page_result:
748+
print(response)
749+
631750
Args:
632751
request (Union[google.pubsub_v1.types.ListTopicSubscriptionsRequest, dict]):
633752
The request object. Request for the
@@ -725,6 +844,25 @@ async def list_topic_snapshots(
725844
bulk. That is, you can set the acknowledgment state of messages
726845
in an existing subscription to the state captured by a snapshot.
727846
847+
848+
.. code-block::
849+
850+
from google import pubsub_v1
851+
852+
def sample_list_topic_snapshots():
853+
# Create a client
854+
client = pubsub_v1.PublisherClient()
855+
856+
# Initialize request argument(s)
857+
request = pubsub_v1.ListTopicSnapshotsRequest(
858+
topic="topic_value",
859+
)
860+
861+
# Make the request
862+
page_result = client.list_topic_snapshots(request=request)
863+
for response in page_result:
864+
print(response)
865+
728866
Args:
729867
request (Union[google.pubsub_v1.types.ListTopicSnapshotsRequest, dict]):
730868
The request object. Request for the `ListTopicSnapshots`
@@ -822,6 +960,23 @@ async def delete_topic(
822960
subscriptions to this topic are not deleted, but their ``topic``
823961
field is set to ``_deleted-topic_``.
824962
963+
964+
.. code-block::
965+
966+
from google import pubsub_v1
967+
968+
def sample_delete_topic():
969+
# Create a client
970+
client = pubsub_v1.PublisherClient()
971+
972+
# Initialize request argument(s)
973+
request = pubsub_v1.DeleteTopicRequest(
974+
topic="topic_value",
975+
)
976+
977+
# Make the request
978+
response = client.delete_topic(request=request)
979+
825980
Args:
826981
request (Union[google.pubsub_v1.types.DeleteTopicRequest, dict]):
827982
The request object. Request for the `DeleteTopic`
@@ -899,6 +1054,26 @@ async def detach_subscription(
8991054
the subscription is a push subscription, pushes to the endpoint
9001055
will stop.
9011056
1057+
1058+
.. code-block::
1059+
1060+
from google import pubsub_v1
1061+
1062+
def sample_detach_subscription():
1063+
# Create a client
1064+
client = pubsub_v1.PublisherClient()
1065+
1066+
# Initialize request argument(s)
1067+
request = pubsub_v1.DetachSubscriptionRequest(
1068+
subscription="subscription_value",
1069+
)
1070+
1071+
# Make the request
1072+
response = client.detach_subscription(request=request)
1073+
1074+
# Handle response
1075+
print(response)
1076+
9021077
Args:
9031078
request (Union[google.pubsub_v1.types.DetachSubscriptionRequest, dict]):
9041079
The request object. Request for the DetachSubscription

0 commit comments

Comments
 (0)