Skip to content

Commit c8d4f5d

Browse files
dpebottseaver
authored andcommitted
Add 'expiration_policy' to subscriber client (#6223)
Re-generate library using 'pubsub/synth.py'.
1 parent f70c00b commit c8d4f5d

File tree

7 files changed

+189
-106
lines changed

7 files changed

+189
-106
lines changed

pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def create_topic(self,
214214
underscores (``_``), periods (``.``), tildes (``~``), plus (``+``) or percent
215215
signs (``%``). It must be between 3 and 255 characters in length, and it
216216
must not start with ``\"goog\"``.
217-
labels (dict[str -> str]): User labels.
217+
labels (dict[str -> str]): See <a href=\"/pubsub/docs/labels\"> Creating and managing labels</a>.
218218
message_storage_policy (Union[dict, ~google.cloud.pubsub_v1.types.MessageStoragePolicy]): Policy constraining how messages published to the topic may be stored. It
219219
is determined when the topic is created based on the policy configured at
220220
the project level. It must not be set by the caller in the request to
@@ -340,8 +340,7 @@ def publish(self,
340340
metadata=None):
341341
"""
342342
Adds one or more messages to the topic. Returns ``NOT_FOUND`` if the topic
343-
does not exist. The message payload must not be empty; it must contain
344-
either a non-empty data field, or at least one attribute.
343+
does not exist.
345344
346345
Example:
347346
>>> from google.cloud import pubsub_v1
@@ -481,8 +480,8 @@ def list_topics(self,
481480
... pass
482481
483482
Args:
484-
project (str): The name of the cloud project that topics belong to.
485-
Format is ``projects/{project}``.
483+
project (str): The name of the project in which to list topics.
484+
Format is ``projects/{project-id}``.
486485
page_size (int): The maximum number of resources contained in the
487486
underlying API response. If page streaming is performed per-
488487
resource, this parameter does not affect the return value. If page

pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py

+24-13
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def create_subscription(self,
216216
retain_acked_messages=None,
217217
message_retention_duration=None,
218218
labels=None,
219+
expiration_policy=None,
219220
retry=google.api_core.gapic_v1.method.DEFAULT,
220221
timeout=google.api_core.gapic_v1.method.DEFAULT,
221222
metadata=None):
@@ -296,7 +297,18 @@ def create_subscription(self,
296297
use. It is not subject to any SLA or deprecation policy.
297298
If a dict is provided, it must be of the same form as the protobuf
298299
message :class:`~google.cloud.pubsub_v1.types.Duration`
299-
labels (dict[str -> str]): User labels.
300+
labels (dict[str -> str]): See <a href=\"/pubsub/docs/labels\"> Creating and managing labels</a>.
301+
expiration_policy (Union[dict, ~google.cloud.pubsub_v1.types.ExpirationPolicy]): A policy that specifies the conditions for this subscription's expiration.
302+
A subscription is considered active as long as any connected subscriber is
303+
successfully consuming messages from the subscription or is issuing
304+
operations on the subscription. If ``expiration_policy`` is not set, a
305+
*default policy* with ``ttl`` of 31 days will be used. The minimum allowed
306+
value for ``expiration_policy.ttl`` is 1 day.
307+
<b>BETA:</b> This feature is part of a beta release. This API might be
308+
changed in backward-incompatible ways and is not recommended for production
309+
use. It is not subject to any SLA or deprecation policy.
310+
If a dict is provided, it must be of the same form as the protobuf
311+
message :class:`~google.cloud.pubsub_v1.types.ExpirationPolicy`
300312
retry (Optional[google.api_core.retry.Retry]): A retry object used
301313
to retry requests. If ``None`` is specified, requests will not
302314
be retried.
@@ -336,6 +348,7 @@ def create_subscription(self,
336348
retain_acked_messages=retain_acked_messages,
337349
message_retention_duration=message_retention_duration,
338350
labels=labels,
351+
expiration_policy=expiration_policy,
339352
)
340353
return self._inner_api_calls['create_subscription'](
341354
request, retry=retry, timeout=timeout, metadata=metadata)
@@ -496,8 +509,8 @@ def list_subscriptions(self,
496509
... pass
497510
498511
Args:
499-
project (str): The name of the cloud project that subscriptions belong to.
500-
Format is ``projects/{project}``.
512+
project (str): The name of the project in which to list subscriptions.
513+
Format is ``projects/{project-id}``.
501514
page_size (int): The maximum number of resources contained in the
502515
underlying API response. If page streaming is performed per-
503516
resource, this parameter does not affect the return value. If page
@@ -762,8 +775,7 @@ def pull(self,
762775
timeout=google.api_core.gapic_v1.method.DEFAULT,
763776
metadata=None):
764777
"""
765-
Pulls messages from the server. Returns an empty list if there are no
766-
messages available in the backlog. The server may return ``UNAVAILABLE`` if
778+
Pulls messages from the server. The server may return ``UNAVAILABLE`` if
767779
there are too many concurrent pull requests pending for the given
768780
subscription.
769781
@@ -787,9 +799,7 @@ def pull(self,
787799
return_immediately (bool): If this field set to true, the system will respond immediately even if
788800
it there are no messages available to return in the ``Pull`` response.
789801
Otherwise, the system may wait (for a bounded amount of time) until at
790-
least one message is available, rather than returning no messages. The
791-
client may cancel the request if it does not wish to wait any longer for
792-
the response.
802+
least one message is available, rather than returning no messages.
793803
retry (Optional[google.api_core.retry.Retry]): A retry object used
794804
to retry requests. If ``None`` is specified, requests will not
795805
be retried.
@@ -1001,8 +1011,8 @@ def list_snapshots(self,
10011011
... pass
10021012
10031013
Args:
1004-
project (str): The name of the cloud project that snapshots belong to.
1005-
Format is ``projects/{project}``.
1014+
project (str): The name of the project in which to list snapshots.
1015+
Format is ``projects/{project-id}``.
10061016
page_size (int): The maximum number of resources contained in the
10071017
underlying API response. If page streaming is performed per-
10081018
resource, this parameter does not affect the return value. If page
@@ -1070,7 +1080,7 @@ def create_snapshot(self,
10701080
Creates a snapshot from the requested subscription.<br><br>
10711081
<b>ALPHA:</b> This feature is part of an alpha release. This API might be
10721082
changed in backward-incompatible ways and is not recommended for production
1073-
use. It is not subject to any SLA or deprecation policy.
1083+
use. It is not subject to any SLA or deprecation policy.<br><br>
10741084
If the snapshot already exists, returns ``ALREADY_EXISTS``.
10751085
If the requested subscription doesn't exist, returns ``NOT_FOUND``.
10761086
If the backlog in the subscription is too old -- and the resulting snapshot
@@ -1097,7 +1107,8 @@ def create_snapshot(self,
10971107
name (str): Optional user-provided name for this snapshot.
10981108
If the name is not provided in the request, the server will assign a random
10991109
name for this snapshot on the same project as the subscription.
1100-
Note that for REST API requests, you must specify a name.
1110+
Note that for REST API requests, you must specify a name. See the
1111+
<a href=\"/pubsub/docs/admin#resource_names\">resource name rules</a>.
11011112
Format is ``projects/{project}/snapshots/{snap}``.
11021113
subscription (str): The subscription whose backlog the snapshot retains.
11031114
Specifically, the created snapshot is guaranteed to retain: \
@@ -1109,7 +1120,7 @@ def create_snapshot(self,
11091120
successful completion of the CreateSnapshot request. \
11101121
11111122
Format is ``projects/{project}/subscriptions/{sub}``.
1112-
labels (dict[str -> str]): User labels.
1123+
labels (dict[str -> str]): See <a href=\"/pubsub/docs/labels\"> Creating and managing labels</a>.
11131124
retry (Optional[google.api_core.retry.Retry]): A retry object used
11141125
to retry requests. If ``None`` is specified, requests will not
11151126
be retried.

pubsub/google/cloud/pubsub_v1/gapic/subscriber_client_config.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"retry_codes": {
55
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
66
"pull": [
7-
"CANCELLED", "DEADLINE_EXCEEDED", "INTERNAL",
8-
"RESOURCE_EXHAUSTED", "UNAVAILABLE"
7+
"DEADLINE_EXCEEDED", "INTERNAL", "RESOURCE_EXHAUSTED",
8+
"UNAVAILABLE"
99
],
1010
"http_get": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
1111
"non_idempotent": []
@@ -72,7 +72,7 @@
7272
},
7373
"Acknowledge": {
7474
"timeout_millis": 60000,
75-
"retry_codes_name": "non_idempotent",
75+
"retry_codes_name": "idempotent",
7676
"retry_params_name": "messaging"
7777
},
7878
"Pull": {

pubsub/google/cloud/pubsub_v1/gapic/transports/publisher_grpc_transport.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ def publish(self):
129129
"""Return the gRPC stub for {$apiMethod.name}.
130130
131131
Adds one or more messages to the topic. Returns ``NOT_FOUND`` if the topic
132-
does not exist. The message payload must not be empty; it must contain
133-
either a non-empty data field, or at least one attribute.
132+
does not exist.
134133
135134
Returns:
136135
Callable: A callable which accepts the appropriate

pubsub/google/cloud/pubsub_v1/gapic/transports/subscriber_grpc_transport.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,7 @@ def acknowledge(self):
216216
def pull(self):
217217
"""Return the gRPC stub for {$apiMethod.name}.
218218
219-
Pulls messages from the server. Returns an empty list if there are no
220-
messages available in the backlog. The server may return ``UNAVAILABLE`` if
219+
Pulls messages from the server. The server may return ``UNAVAILABLE`` if
221220
there are too many concurrent pull requests pending for the given
222221
subscription.
223222
@@ -288,7 +287,7 @@ def create_snapshot(self):
288287
Creates a snapshot from the requested subscription.<br><br>
289288
<b>ALPHA:</b> This feature is part of an alpha release. This API might be
290289
changed in backward-incompatible ways and is not recommended for production
291-
use. It is not subject to any SLA or deprecation policy.
290+
use. It is not subject to any SLA or deprecation policy.<br><br>
292291
If the snapshot already exists, returns ``ALREADY_EXISTS``.
293292
If the requested subscription doesn't exist, returns ``NOT_FOUND``.
294293
If the backlog in the subscription is too old -- and the resulting snapshot

0 commit comments

Comments
 (0)