1# -*- coding: utf-8 -*-
2# Copyright 2025 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16from __future__ import annotations
17
18from typing import MutableMapping, MutableSequence
19
20import proto # type: ignore
21
22from google.protobuf import duration_pb2 # type: ignore
23from google.protobuf import field_mask_pb2 # type: ignore
24from google.protobuf import timestamp_pb2 # type: ignore
25from google.pubsub_v1.types import schema as gp_schema
26
27
28__protobuf__ = proto.module(
29 package="google.pubsub.v1",
30 manifest={
31 "MessageStoragePolicy",
32 "SchemaSettings",
33 "IngestionDataSourceSettings",
34 "PlatformLogsSettings",
35 "IngestionFailureEvent",
36 "JavaScriptUDF",
37 "MessageTransform",
38 "Topic",
39 "PubsubMessage",
40 "GetTopicRequest",
41 "UpdateTopicRequest",
42 "PublishRequest",
43 "PublishResponse",
44 "ListTopicsRequest",
45 "ListTopicsResponse",
46 "ListTopicSubscriptionsRequest",
47 "ListTopicSubscriptionsResponse",
48 "ListTopicSnapshotsRequest",
49 "ListTopicSnapshotsResponse",
50 "DeleteTopicRequest",
51 "DetachSubscriptionRequest",
52 "DetachSubscriptionResponse",
53 "Subscription",
54 "RetryPolicy",
55 "DeadLetterPolicy",
56 "ExpirationPolicy",
57 "PushConfig",
58 "BigQueryConfig",
59 "CloudStorageConfig",
60 "ReceivedMessage",
61 "GetSubscriptionRequest",
62 "UpdateSubscriptionRequest",
63 "ListSubscriptionsRequest",
64 "ListSubscriptionsResponse",
65 "DeleteSubscriptionRequest",
66 "ModifyPushConfigRequest",
67 "PullRequest",
68 "PullResponse",
69 "ModifyAckDeadlineRequest",
70 "AcknowledgeRequest",
71 "StreamingPullRequest",
72 "StreamingPullResponse",
73 "CreateSnapshotRequest",
74 "UpdateSnapshotRequest",
75 "Snapshot",
76 "GetSnapshotRequest",
77 "ListSnapshotsRequest",
78 "ListSnapshotsResponse",
79 "DeleteSnapshotRequest",
80 "SeekRequest",
81 "SeekResponse",
82 },
83)
84
85
86class MessageStoragePolicy(proto.Message):
87 r"""A policy constraining the storage of messages published to
88 the topic.
89
90 Attributes:
91 allowed_persistence_regions (MutableSequence[str]):
92 Optional. A list of IDs of Google Cloud
93 regions where messages that are published to the
94 topic may be persisted in storage. Messages
95 published by publishers running in non-allowed
96 Google Cloud regions (or running outside of
97 Google Cloud altogether) are routed for storage
98 in one of the allowed regions. An empty list
99 means that no regions are allowed, and is not a
100 valid configuration.
101 enforce_in_transit (bool):
102 Optional. If true, ``allowed_persistence_regions`` is also
103 used to enforce in-transit guarantees for messages. That is,
104 Pub/Sub will fail Publish operations on this topic and
105 subscribe operations on any subscription attached to this
106 topic in any region that is not in
107 ``allowed_persistence_regions``.
108 """
109
110 allowed_persistence_regions: MutableSequence[str] = proto.RepeatedField(
111 proto.STRING,
112 number=1,
113 )
114 enforce_in_transit: bool = proto.Field(
115 proto.BOOL,
116 number=2,
117 )
118
119
120class SchemaSettings(proto.Message):
121 r"""Settings for validating messages published against a schema.
122
123 Attributes:
124 schema (str):
125 Required. The name of the schema that messages published
126 should be validated against. Format is
127 ``projects/{project}/schemas/{schema}``. The value of this
128 field will be ``_deleted-schema_`` if the schema has been
129 deleted.
130 encoding (google.pubsub_v1.types.Encoding):
131 Optional. The encoding of messages validated against
132 ``schema``.
133 first_revision_id (str):
134 Optional. The minimum (inclusive) revision allowed for
135 validating messages. If empty or not present, allow any
136 revision to be validated against last_revision or any
137 revision created before.
138 last_revision_id (str):
139 Optional. The maximum (inclusive) revision allowed for
140 validating messages. If empty or not present, allow any
141 revision to be validated against first_revision or any
142 revision created after.
143 """
144
145 schema: str = proto.Field(
146 proto.STRING,
147 number=1,
148 )
149 encoding: gp_schema.Encoding = proto.Field(
150 proto.ENUM,
151 number=2,
152 enum=gp_schema.Encoding,
153 )
154 first_revision_id: str = proto.Field(
155 proto.STRING,
156 number=3,
157 )
158 last_revision_id: str = proto.Field(
159 proto.STRING,
160 number=4,
161 )
162
163
164class IngestionDataSourceSettings(proto.Message):
165 r"""Settings for an ingestion data source on a topic.
166
167 This message has `oneof`_ fields (mutually exclusive fields).
168 For each oneof, at most one member field can be set at the same time.
169 Setting any member of the oneof automatically clears all other
170 members.
171
172 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
173
174 Attributes:
175 aws_kinesis (google.pubsub_v1.types.IngestionDataSourceSettings.AwsKinesis):
176 Optional. Amazon Kinesis Data Streams.
177
178 This field is a member of `oneof`_ ``source``.
179 cloud_storage (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage):
180 Optional. Cloud Storage.
181
182 This field is a member of `oneof`_ ``source``.
183 azure_event_hubs (google.pubsub_v1.types.IngestionDataSourceSettings.AzureEventHubs):
184 Optional. Azure Event Hubs.
185
186 This field is a member of `oneof`_ ``source``.
187 aws_msk (google.pubsub_v1.types.IngestionDataSourceSettings.AwsMsk):
188 Optional. Amazon MSK.
189
190 This field is a member of `oneof`_ ``source``.
191 confluent_cloud (google.pubsub_v1.types.IngestionDataSourceSettings.ConfluentCloud):
192 Optional. Confluent Cloud.
193
194 This field is a member of `oneof`_ ``source``.
195 platform_logs_settings (google.pubsub_v1.types.PlatformLogsSettings):
196 Optional. Platform Logs settings. If unset,
197 no Platform Logs will be generated.
198 """
199
200 class AwsKinesis(proto.Message):
201 r"""Ingestion settings for Amazon Kinesis Data Streams.
202
203 Attributes:
204 state (google.pubsub_v1.types.IngestionDataSourceSettings.AwsKinesis.State):
205 Output only. An output-only field that
206 indicates the state of the Kinesis ingestion
207 source.
208 stream_arn (str):
209 Required. The Kinesis stream ARN to ingest
210 data from.
211 consumer_arn (str):
212 Required. The Kinesis consumer ARN to used
213 for ingestion in Enhanced Fan-Out mode. The
214 consumer must be already created and ready to be
215 used.
216 aws_role_arn (str):
217 Required. AWS role ARN to be used for
218 Federated Identity authentication with Kinesis.
219 Check the Pub/Sub docs for how to set up this
220 role and the required permissions that need to
221 be attached to it.
222 gcp_service_account (str):
223 Required. The GCP service account to be used for Federated
224 Identity authentication with Kinesis (via a
225 ``AssumeRoleWithWebIdentity`` call for the provided role).
226 The ``aws_role_arn`` must be set up with
227 ``accounts.google.com:sub`` equals to this service account
228 number.
229 """
230
231 class State(proto.Enum):
232 r"""Possible states for ingestion from Amazon Kinesis Data
233 Streams.
234
235 Values:
236 STATE_UNSPECIFIED (0):
237 Default value. This value is unused.
238 ACTIVE (1):
239 Ingestion is active.
240 KINESIS_PERMISSION_DENIED (2):
241 Permission denied encountered while consuming data from
242 Kinesis. This can happen if:
243
244 - The provided ``aws_role_arn`` does not exist or does not
245 have the appropriate permissions attached.
246 - The provided ``aws_role_arn`` is not set up properly for
247 Identity Federation using ``gcp_service_account``.
248 - The Pub/Sub SA is not granted the
249 ``iam.serviceAccounts.getOpenIdToken`` permission on
250 ``gcp_service_account``.
251 PUBLISH_PERMISSION_DENIED (3):
252 Permission denied encountered while publishing to the topic.
253 This can happen if the Pub/Sub SA has not been granted the
254 `appropriate publish
255 permissions <https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher>`__
256 STREAM_NOT_FOUND (4):
257 The Kinesis stream does not exist.
258 CONSUMER_NOT_FOUND (5):
259 The Kinesis consumer does not exist.
260 """
261 STATE_UNSPECIFIED = 0
262 ACTIVE = 1
263 KINESIS_PERMISSION_DENIED = 2
264 PUBLISH_PERMISSION_DENIED = 3
265 STREAM_NOT_FOUND = 4
266 CONSUMER_NOT_FOUND = 5
267
268 state: "IngestionDataSourceSettings.AwsKinesis.State" = proto.Field(
269 proto.ENUM,
270 number=1,
271 enum="IngestionDataSourceSettings.AwsKinesis.State",
272 )
273 stream_arn: str = proto.Field(
274 proto.STRING,
275 number=2,
276 )
277 consumer_arn: str = proto.Field(
278 proto.STRING,
279 number=3,
280 )
281 aws_role_arn: str = proto.Field(
282 proto.STRING,
283 number=4,
284 )
285 gcp_service_account: str = proto.Field(
286 proto.STRING,
287 number=5,
288 )
289
290 class CloudStorage(proto.Message):
291 r"""Ingestion settings for Cloud Storage.
292
293 This message has `oneof`_ fields (mutually exclusive fields).
294 For each oneof, at most one member field can be set at the same time.
295 Setting any member of the oneof automatically clears all other
296 members.
297
298 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
299
300 Attributes:
301 state (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.State):
302 Output only. An output-only field that
303 indicates the state of the Cloud Storage
304 ingestion source.
305 bucket (str):
306 Optional. Cloud Storage bucket. The bucket name must be
307 without any prefix like "gs://". See the [bucket naming
308 requirements]
309 (https://cloud.google.com/storage/docs/buckets#naming).
310 text_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.TextFormat):
311 Optional. Data from Cloud Storage will be
312 interpreted as text.
313
314 This field is a member of `oneof`_ ``input_format``.
315 avro_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.AvroFormat):
316 Optional. Data from Cloud Storage will be
317 interpreted in Avro format.
318
319 This field is a member of `oneof`_ ``input_format``.
320 pubsub_avro_format (google.pubsub_v1.types.IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat):
321 Optional. It will be assumed data from Cloud Storage was
322 written via `Cloud Storage
323 subscriptions <https://cloud.google.com/pubsub/docs/cloudstorage>`__.
324
325 This field is a member of `oneof`_ ``input_format``.
326 minimum_object_create_time (google.protobuf.timestamp_pb2.Timestamp):
327 Optional. Only objects with a larger or equal
328 creation timestamp will be ingested.
329 match_glob (str):
330 Optional. Glob pattern used to match objects that will be
331 ingested. If unset, all objects will be ingested. See the
332 `supported
333 patterns <https://cloud.google.com/storage/docs/json_api/v1/objects/list#list-objects-and-prefixes-using-glob>`__.
334 """
335
336 class State(proto.Enum):
337 r"""Possible states for ingestion from Cloud Storage.
338
339 Values:
340 STATE_UNSPECIFIED (0):
341 Default value. This value is unused.
342 ACTIVE (1):
343 Ingestion is active.
344 CLOUD_STORAGE_PERMISSION_DENIED (2):
345 Permission denied encountered while calling the Cloud
346 Storage API. This can happen if the Pub/Sub SA has not been
347 granted the `appropriate
348 permissions <https://cloud.google.com/storage/docs/access-control/iam-permissions>`__:
349
350 - storage.objects.list: to list the objects in a bucket.
351 - storage.objects.get: to read the objects in a bucket.
352 - storage.buckets.get: to verify the bucket exists.
353 PUBLISH_PERMISSION_DENIED (3):
354 Permission denied encountered while publishing to the topic.
355 This can happen if the Pub/Sub SA has not been granted the
356 `appropriate publish
357 permissions <https://cloud.google.com/pubsub/docs/access-control#pubsub.publisher>`__
358 BUCKET_NOT_FOUND (4):
359 The provided Cloud Storage bucket doesn't
360 exist.
361 TOO_MANY_OBJECTS (5):
362 The Cloud Storage bucket has too many
363 objects, ingestion will be paused.
364 """
365 STATE_UNSPECIFIED = 0
366 ACTIVE = 1
367 CLOUD_STORAGE_PERMISSION_DENIED = 2
368 PUBLISH_PERMISSION_DENIED = 3
369 BUCKET_NOT_FOUND = 4
370 TOO_MANY_OBJECTS = 5
371
372 class TextFormat(proto.Message):
373 r"""Configuration for reading Cloud Storage data in text format. Each
374 line of text as specified by the delimiter will be set to the
375 ``data`` field of a Pub/Sub message.
376
377
378 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
379
380 Attributes:
381 delimiter (str):
382 Optional. When unset, '\n' is used.
383
384 This field is a member of `oneof`_ ``_delimiter``.
385 """
386
387 delimiter: str = proto.Field(
388 proto.STRING,
389 number=1,
390 optional=True,
391 )
392
393 class AvroFormat(proto.Message):
394 r"""Configuration for reading Cloud Storage data in Avro binary format.
395 The bytes of each object will be set to the ``data`` field of a
396 Pub/Sub message.
397
398 """
399
400 class PubSubAvroFormat(proto.Message):
401 r"""Configuration for reading Cloud Storage data written via `Cloud
402 Storage
403 subscriptions <https://cloud.google.com/pubsub/docs/cloudstorage>`__.
404 The data and attributes fields of the originally exported Pub/Sub
405 message will be restored when publishing.
406
407 """
408
409 state: "IngestionDataSourceSettings.CloudStorage.State" = proto.Field(
410 proto.ENUM,
411 number=1,
412 enum="IngestionDataSourceSettings.CloudStorage.State",
413 )
414 bucket: str = proto.Field(
415 proto.STRING,
416 number=2,
417 )
418 text_format: "IngestionDataSourceSettings.CloudStorage.TextFormat" = (
419 proto.Field(
420 proto.MESSAGE,
421 number=3,
422 oneof="input_format",
423 message="IngestionDataSourceSettings.CloudStorage.TextFormat",
424 )
425 )
426 avro_format: "IngestionDataSourceSettings.CloudStorage.AvroFormat" = (
427 proto.Field(
428 proto.MESSAGE,
429 number=4,
430 oneof="input_format",
431 message="IngestionDataSourceSettings.CloudStorage.AvroFormat",
432 )
433 )
434 pubsub_avro_format: "IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat" = proto.Field(
435 proto.MESSAGE,
436 number=5,
437 oneof="input_format",
438 message="IngestionDataSourceSettings.CloudStorage.PubSubAvroFormat",
439 )
440 minimum_object_create_time: timestamp_pb2.Timestamp = proto.Field(
441 proto.MESSAGE,
442 number=6,
443 message=timestamp_pb2.Timestamp,
444 )
445 match_glob: str = proto.Field(
446 proto.STRING,
447 number=9,
448 )
449
450 class AzureEventHubs(proto.Message):
451 r"""Ingestion settings for Azure Event Hubs.
452
453 Attributes:
454 state (google.pubsub_v1.types.IngestionDataSourceSettings.AzureEventHubs.State):
455 Output only. An output-only field that
456 indicates the state of the Event Hubs ingestion
457 source.
458 resource_group (str):
459 Optional. Name of the resource group within
460 the azure subscription.
461 namespace (str):
462 Optional. The name of the Event Hubs
463 namespace.
464 event_hub (str):
465 Optional. The name of the Event Hub.
466 client_id (str):
467 Optional. The client id of the Azure
468 application that is being used to authenticate
469 Pub/Sub.
470 tenant_id (str):
471 Optional. The tenant id of the Azure
472 application that is being used to authenticate
473 Pub/Sub.
474 subscription_id (str):
475 Optional. The Azure subscription id.
476 gcp_service_account (str):
477 Optional. The GCP service account to be used
478 for Federated Identity authentication.
479 """
480
481 class State(proto.Enum):
482 r"""Possible states for managed ingestion from Event Hubs.
483
484 Values:
485 STATE_UNSPECIFIED (0):
486 Default value. This value is unused.
487 ACTIVE (1):
488 Ingestion is active.
489 EVENT_HUBS_PERMISSION_DENIED (2):
490 Permission denied encountered while consuming data from
491 Event Hubs. This can happen when ``client_id``, or
492 ``tenant_id`` are invalid. Or the right permissions haven't
493 been granted.
494 PUBLISH_PERMISSION_DENIED (3):
495 Permission denied encountered while
496 publishing to the topic.
497 NAMESPACE_NOT_FOUND (4):
498 The provided Event Hubs namespace couldn't be
499 found.
500 EVENT_HUB_NOT_FOUND (5):
501 The provided Event Hub couldn't be found.
502 SUBSCRIPTION_NOT_FOUND (6):
503 The provided Event Hubs subscription couldn't
504 be found.
505 RESOURCE_GROUP_NOT_FOUND (7):
506 The provided Event Hubs resource group
507 couldn't be found.
508 """
509 STATE_UNSPECIFIED = 0
510 ACTIVE = 1
511 EVENT_HUBS_PERMISSION_DENIED = 2
512 PUBLISH_PERMISSION_DENIED = 3
513 NAMESPACE_NOT_FOUND = 4
514 EVENT_HUB_NOT_FOUND = 5
515 SUBSCRIPTION_NOT_FOUND = 6
516 RESOURCE_GROUP_NOT_FOUND = 7
517
518 state: "IngestionDataSourceSettings.AzureEventHubs.State" = proto.Field(
519 proto.ENUM,
520 number=1,
521 enum="IngestionDataSourceSettings.AzureEventHubs.State",
522 )
523 resource_group: str = proto.Field(
524 proto.STRING,
525 number=2,
526 )
527 namespace: str = proto.Field(
528 proto.STRING,
529 number=3,
530 )
531 event_hub: str = proto.Field(
532 proto.STRING,
533 number=4,
534 )
535 client_id: str = proto.Field(
536 proto.STRING,
537 number=5,
538 )
539 tenant_id: str = proto.Field(
540 proto.STRING,
541 number=6,
542 )
543 subscription_id: str = proto.Field(
544 proto.STRING,
545 number=7,
546 )
547 gcp_service_account: str = proto.Field(
548 proto.STRING,
549 number=8,
550 )
551
552 class AwsMsk(proto.Message):
553 r"""Ingestion settings for Amazon MSK.
554
555 Attributes:
556 state (google.pubsub_v1.types.IngestionDataSourceSettings.AwsMsk.State):
557 Output only. An output-only field that
558 indicates the state of the Amazon MSK ingestion
559 source.
560 cluster_arn (str):
561 Required. The Amazon Resource Name (ARN) that
562 uniquely identifies the cluster.
563 topic (str):
564 Required. The name of the topic in the Amazon
565 MSK cluster that Pub/Sub will import from.
566 aws_role_arn (str):
567 Required. AWS role ARN to be used for
568 Federated Identity authentication with Amazon
569 MSK. Check the Pub/Sub docs for how to set up
570 this role and the required permissions that need
571 to be attached to it.
572 gcp_service_account (str):
573 Required. The GCP service account to be used for Federated
574 Identity authentication with Amazon MSK (via a
575 ``AssumeRoleWithWebIdentity`` call for the provided role).
576 The ``aws_role_arn`` must be set up with
577 ``accounts.google.com:sub`` equals to this service account
578 number.
579 """
580
581 class State(proto.Enum):
582 r"""Possible states for managed ingestion from Amazon MSK.
583
584 Values:
585 STATE_UNSPECIFIED (0):
586 Default value. This value is unused.
587 ACTIVE (1):
588 Ingestion is active.
589 MSK_PERMISSION_DENIED (2):
590 Permission denied encountered while consuming
591 data from Amazon MSK.
592 PUBLISH_PERMISSION_DENIED (3):
593 Permission denied encountered while
594 publishing to the topic.
595 CLUSTER_NOT_FOUND (4):
596 The provided MSK cluster wasn't found.
597 TOPIC_NOT_FOUND (5):
598 The provided topic wasn't found.
599 """
600 STATE_UNSPECIFIED = 0
601 ACTIVE = 1
602 MSK_PERMISSION_DENIED = 2
603 PUBLISH_PERMISSION_DENIED = 3
604 CLUSTER_NOT_FOUND = 4
605 TOPIC_NOT_FOUND = 5
606
607 state: "IngestionDataSourceSettings.AwsMsk.State" = proto.Field(
608 proto.ENUM,
609 number=1,
610 enum="IngestionDataSourceSettings.AwsMsk.State",
611 )
612 cluster_arn: str = proto.Field(
613 proto.STRING,
614 number=2,
615 )
616 topic: str = proto.Field(
617 proto.STRING,
618 number=3,
619 )
620 aws_role_arn: str = proto.Field(
621 proto.STRING,
622 number=4,
623 )
624 gcp_service_account: str = proto.Field(
625 proto.STRING,
626 number=5,
627 )
628
629 class ConfluentCloud(proto.Message):
630 r"""Ingestion settings for Confluent Cloud.
631
632 Attributes:
633 state (google.pubsub_v1.types.IngestionDataSourceSettings.ConfluentCloud.State):
634 Output only. An output-only field that
635 indicates the state of the Confluent Cloud
636 ingestion source.
637 bootstrap_server (str):
638 Required. The address of the bootstrap
639 server. The format is url:port.
640 cluster_id (str):
641 Required. The id of the cluster.
642 topic (str):
643 Required. The name of the topic in the
644 Confluent Cloud cluster that Pub/Sub will import
645 from.
646 identity_pool_id (str):
647 Required. The id of the identity pool to be
648 used for Federated Identity authentication with
649 Confluent Cloud. See
650 https://docs.confluent.io/cloud/current/security/authenticate/workload-identities/identity-providers/oauth/identity-pools.html#add-oauth-identity-pools.
651 gcp_service_account (str):
652 Required. The GCP service account to be used for Federated
653 Identity authentication with ``identity_pool_id``.
654 """
655
656 class State(proto.Enum):
657 r"""Possible states for managed ingestion from Confluent Cloud.
658
659 Values:
660 STATE_UNSPECIFIED (0):
661 Default value. This value is unused.
662 ACTIVE (1):
663 Ingestion is active.
664 CONFLUENT_CLOUD_PERMISSION_DENIED (2):
665 Permission denied encountered while consuming
666 data from Confluent Cloud.
667 PUBLISH_PERMISSION_DENIED (3):
668 Permission denied encountered while
669 publishing to the topic.
670 UNREACHABLE_BOOTSTRAP_SERVER (4):
671 The provided bootstrap server address is
672 unreachable.
673 CLUSTER_NOT_FOUND (5):
674 The provided cluster wasn't found.
675 TOPIC_NOT_FOUND (6):
676 The provided topic wasn't found.
677 """
678 STATE_UNSPECIFIED = 0
679 ACTIVE = 1
680 CONFLUENT_CLOUD_PERMISSION_DENIED = 2
681 PUBLISH_PERMISSION_DENIED = 3
682 UNREACHABLE_BOOTSTRAP_SERVER = 4
683 CLUSTER_NOT_FOUND = 5
684 TOPIC_NOT_FOUND = 6
685
686 state: "IngestionDataSourceSettings.ConfluentCloud.State" = proto.Field(
687 proto.ENUM,
688 number=1,
689 enum="IngestionDataSourceSettings.ConfluentCloud.State",
690 )
691 bootstrap_server: str = proto.Field(
692 proto.STRING,
693 number=2,
694 )
695 cluster_id: str = proto.Field(
696 proto.STRING,
697 number=3,
698 )
699 topic: str = proto.Field(
700 proto.STRING,
701 number=4,
702 )
703 identity_pool_id: str = proto.Field(
704 proto.STRING,
705 number=5,
706 )
707 gcp_service_account: str = proto.Field(
708 proto.STRING,
709 number=6,
710 )
711
712 aws_kinesis: AwsKinesis = proto.Field(
713 proto.MESSAGE,
714 number=1,
715 oneof="source",
716 message=AwsKinesis,
717 )
718 cloud_storage: CloudStorage = proto.Field(
719 proto.MESSAGE,
720 number=2,
721 oneof="source",
722 message=CloudStorage,
723 )
724 azure_event_hubs: AzureEventHubs = proto.Field(
725 proto.MESSAGE,
726 number=3,
727 oneof="source",
728 message=AzureEventHubs,
729 )
730 aws_msk: AwsMsk = proto.Field(
731 proto.MESSAGE,
732 number=5,
733 oneof="source",
734 message=AwsMsk,
735 )
736 confluent_cloud: ConfluentCloud = proto.Field(
737 proto.MESSAGE,
738 number=6,
739 oneof="source",
740 message=ConfluentCloud,
741 )
742 platform_logs_settings: "PlatformLogsSettings" = proto.Field(
743 proto.MESSAGE,
744 number=4,
745 message="PlatformLogsSettings",
746 )
747
748
749class PlatformLogsSettings(proto.Message):
750 r"""Settings for Platform Logs produced by Pub/Sub.
751
752 Attributes:
753 severity (google.pubsub_v1.types.PlatformLogsSettings.Severity):
754 Optional. The minimum severity level of
755 Platform Logs that will be written.
756 """
757
758 class Severity(proto.Enum):
759 r"""Severity levels of Platform Logs.
760
761 Values:
762 SEVERITY_UNSPECIFIED (0):
763 Default value. Logs level is unspecified.
764 Logs will be disabled.
765 DISABLED (1):
766 Logs will be disabled.
767 DEBUG (2):
768 Debug logs and higher-severity logs will be
769 written.
770 INFO (3):
771 Info logs and higher-severity logs will be
772 written.
773 WARNING (4):
774 Warning logs and higher-severity logs will be
775 written.
776 ERROR (5):
777 Only error logs will be written.
778 """
779 SEVERITY_UNSPECIFIED = 0
780 DISABLED = 1
781 DEBUG = 2
782 INFO = 3
783 WARNING = 4
784 ERROR = 5
785
786 severity: Severity = proto.Field(
787 proto.ENUM,
788 number=1,
789 enum=Severity,
790 )
791
792
793class IngestionFailureEvent(proto.Message):
794 r"""Payload of the Platform Log entry sent when a failure is
795 encountered while ingesting.
796
797 This message has `oneof`_ fields (mutually exclusive fields).
798 For each oneof, at most one member field can be set at the same time.
799 Setting any member of the oneof automatically clears all other
800 members.
801
802 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
803
804 Attributes:
805 topic (str):
806 Required. Name of the import topic. Format is:
807 projects/{project_name}/topics/{topic_name}.
808 error_message (str):
809 Required. Error details explaining why
810 ingestion to Pub/Sub has failed.
811 cloud_storage_failure (google.pubsub_v1.types.IngestionFailureEvent.CloudStorageFailure):
812 Optional. Failure when ingesting from Cloud
813 Storage.
814
815 This field is a member of `oneof`_ ``failure``.
816 aws_msk_failure (google.pubsub_v1.types.IngestionFailureEvent.AwsMskFailureReason):
817 Optional. Failure when ingesting from Amazon
818 MSK.
819
820 This field is a member of `oneof`_ ``failure``.
821 azure_event_hubs_failure (google.pubsub_v1.types.IngestionFailureEvent.AzureEventHubsFailureReason):
822 Optional. Failure when ingesting from Azure
823 Event Hubs.
824
825 This field is a member of `oneof`_ ``failure``.
826 confluent_cloud_failure (google.pubsub_v1.types.IngestionFailureEvent.ConfluentCloudFailureReason):
827 Optional. Failure when ingesting from
828 Confluent Cloud.
829
830 This field is a member of `oneof`_ ``failure``.
831 aws_kinesis_failure (google.pubsub_v1.types.IngestionFailureEvent.AwsKinesisFailureReason):
832 Optional. Failure when ingesting from AWS
833 Kinesis.
834
835 This field is a member of `oneof`_ ``failure``.
836 """
837
838 class ApiViolationReason(proto.Message):
839 r"""Specifies the reason why some data may have been left out of the
840 desired Pub/Sub message due to the API message limits
841 (https://cloud.google.com/pubsub/quotas#resource_limits). For
842 example, when the number of attributes is larger than 100, the
843 number of attributes is truncated to 100 to respect the limit on the
844 attribute count. Other attribute limits are treated similarly. When
845 the size of the desired message would've been larger than 10MB, the
846 message won't be published at all, and ingestion of the subsequent
847 messages will proceed as normal.
848
849 """
850
851 class AvroFailureReason(proto.Message):
852 r"""Set when an Avro file is unsupported or its format is not
853 valid. When this occurs, one or more Avro objects won't be
854 ingested.
855
856 """
857
858 class SchemaViolationReason(proto.Message):
859 r"""Set when a Pub/Sub message fails to get published due to a
860 schema validation violation.
861
862 """
863
864 class CloudStorageFailure(proto.Message):
865 r"""Failure when ingesting from a Cloud Storage source.
866
867 This message has `oneof`_ fields (mutually exclusive fields).
868 For each oneof, at most one member field can be set at the same time.
869 Setting any member of the oneof automatically clears all other
870 members.
871
872 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
873
874 Attributes:
875 bucket (str):
876 Optional. Name of the Cloud Storage bucket
877 used for ingestion.
878 object_name (str):
879 Optional. Name of the Cloud Storage object
880 which contained the section that couldn't be
881 ingested.
882 object_generation (int):
883 Optional. Generation of the Cloud Storage
884 object which contained the section that couldn't
885 be ingested.
886 avro_failure_reason (google.pubsub_v1.types.IngestionFailureEvent.AvroFailureReason):
887 Optional. Failure encountered when parsing an
888 Avro file.
889
890 This field is a member of `oneof`_ ``reason``.
891 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
892 Optional. The Pub/Sub API limits prevented
893 the desired message from being published.
894
895 This field is a member of `oneof`_ ``reason``.
896 schema_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.SchemaViolationReason):
897 Optional. The Pub/Sub message failed schema
898 validation.
899
900 This field is a member of `oneof`_ ``reason``.
901 """
902
903 bucket: str = proto.Field(
904 proto.STRING,
905 number=1,
906 )
907 object_name: str = proto.Field(
908 proto.STRING,
909 number=2,
910 )
911 object_generation: int = proto.Field(
912 proto.INT64,
913 number=3,
914 )
915 avro_failure_reason: "IngestionFailureEvent.AvroFailureReason" = proto.Field(
916 proto.MESSAGE,
917 number=5,
918 oneof="reason",
919 message="IngestionFailureEvent.AvroFailureReason",
920 )
921 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
922 proto.MESSAGE,
923 number=6,
924 oneof="reason",
925 message="IngestionFailureEvent.ApiViolationReason",
926 )
927 schema_violation_reason: "IngestionFailureEvent.SchemaViolationReason" = (
928 proto.Field(
929 proto.MESSAGE,
930 number=7,
931 oneof="reason",
932 message="IngestionFailureEvent.SchemaViolationReason",
933 )
934 )
935
936 class AwsMskFailureReason(proto.Message):
937 r"""Failure when ingesting from an Amazon MSK source.
938
939 This message has `oneof`_ fields (mutually exclusive fields).
940 For each oneof, at most one member field can be set at the same time.
941 Setting any member of the oneof automatically clears all other
942 members.
943
944 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
945
946 Attributes:
947 cluster_arn (str):
948 Optional. The ARN of the cluster of the topic
949 being ingested from.
950 kafka_topic (str):
951 Optional. The name of the Kafka topic being
952 ingested from.
953 partition_id (int):
954 Optional. The partition ID of the message
955 that failed to be ingested.
956 offset (int):
957 Optional. The offset within the partition of
958 the message that failed to be ingested.
959 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
960 Optional. The Pub/Sub API limits prevented
961 the desired message from being published.
962
963 This field is a member of `oneof`_ ``reason``.
964 schema_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.SchemaViolationReason):
965 Optional. The Pub/Sub message failed schema
966 validation.
967
968 This field is a member of `oneof`_ ``reason``.
969 """
970
971 cluster_arn: str = proto.Field(
972 proto.STRING,
973 number=1,
974 )
975 kafka_topic: str = proto.Field(
976 proto.STRING,
977 number=2,
978 )
979 partition_id: int = proto.Field(
980 proto.INT64,
981 number=3,
982 )
983 offset: int = proto.Field(
984 proto.INT64,
985 number=4,
986 )
987 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
988 proto.MESSAGE,
989 number=5,
990 oneof="reason",
991 message="IngestionFailureEvent.ApiViolationReason",
992 )
993 schema_violation_reason: "IngestionFailureEvent.SchemaViolationReason" = (
994 proto.Field(
995 proto.MESSAGE,
996 number=6,
997 oneof="reason",
998 message="IngestionFailureEvent.SchemaViolationReason",
999 )
1000 )
1001
1002 class AzureEventHubsFailureReason(proto.Message):
1003 r"""Failure when ingesting from an Azure Event Hubs source.
1004
1005 This message has `oneof`_ fields (mutually exclusive fields).
1006 For each oneof, at most one member field can be set at the same time.
1007 Setting any member of the oneof automatically clears all other
1008 members.
1009
1010 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1011
1012 Attributes:
1013 namespace (str):
1014 Optional. The namespace containing the event
1015 hub being ingested from.
1016 event_hub (str):
1017 Optional. The name of the event hub being
1018 ingested from.
1019 partition_id (int):
1020 Optional. The partition ID of the message
1021 that failed to be ingested.
1022 offset (int):
1023 Optional. The offset within the partition of
1024 the message that failed to be ingested.
1025 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
1026 Optional. The Pub/Sub API limits prevented
1027 the desired message from being published.
1028
1029 This field is a member of `oneof`_ ``reason``.
1030 schema_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.SchemaViolationReason):
1031 Optional. The Pub/Sub message failed schema
1032 validation.
1033
1034 This field is a member of `oneof`_ ``reason``.
1035 """
1036
1037 namespace: str = proto.Field(
1038 proto.STRING,
1039 number=1,
1040 )
1041 event_hub: str = proto.Field(
1042 proto.STRING,
1043 number=2,
1044 )
1045 partition_id: int = proto.Field(
1046 proto.INT64,
1047 number=3,
1048 )
1049 offset: int = proto.Field(
1050 proto.INT64,
1051 number=4,
1052 )
1053 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
1054 proto.MESSAGE,
1055 number=5,
1056 oneof="reason",
1057 message="IngestionFailureEvent.ApiViolationReason",
1058 )
1059 schema_violation_reason: "IngestionFailureEvent.SchemaViolationReason" = (
1060 proto.Field(
1061 proto.MESSAGE,
1062 number=6,
1063 oneof="reason",
1064 message="IngestionFailureEvent.SchemaViolationReason",
1065 )
1066 )
1067
1068 class ConfluentCloudFailureReason(proto.Message):
1069 r"""Failure when ingesting from a Confluent Cloud source.
1070
1071 This message has `oneof`_ fields (mutually exclusive fields).
1072 For each oneof, at most one member field can be set at the same time.
1073 Setting any member of the oneof automatically clears all other
1074 members.
1075
1076 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1077
1078 Attributes:
1079 cluster_id (str):
1080 Optional. The cluster ID containing the topic
1081 being ingested from.
1082 kafka_topic (str):
1083 Optional. The name of the Kafka topic being
1084 ingested from.
1085 partition_id (int):
1086 Optional. The partition ID of the message
1087 that failed to be ingested.
1088 offset (int):
1089 Optional. The offset within the partition of
1090 the message that failed to be ingested.
1091 api_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.ApiViolationReason):
1092 Optional. The Pub/Sub API limits prevented
1093 the desired message from being published.
1094
1095 This field is a member of `oneof`_ ``reason``.
1096 schema_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.SchemaViolationReason):
1097 Optional. The Pub/Sub message failed schema
1098 validation.
1099
1100 This field is a member of `oneof`_ ``reason``.
1101 """
1102
1103 cluster_id: str = proto.Field(
1104 proto.STRING,
1105 number=1,
1106 )
1107 kafka_topic: str = proto.Field(
1108 proto.STRING,
1109 number=2,
1110 )
1111 partition_id: int = proto.Field(
1112 proto.INT64,
1113 number=3,
1114 )
1115 offset: int = proto.Field(
1116 proto.INT64,
1117 number=4,
1118 )
1119 api_violation_reason: "IngestionFailureEvent.ApiViolationReason" = proto.Field(
1120 proto.MESSAGE,
1121 number=5,
1122 oneof="reason",
1123 message="IngestionFailureEvent.ApiViolationReason",
1124 )
1125 schema_violation_reason: "IngestionFailureEvent.SchemaViolationReason" = (
1126 proto.Field(
1127 proto.MESSAGE,
1128 number=6,
1129 oneof="reason",
1130 message="IngestionFailureEvent.SchemaViolationReason",
1131 )
1132 )
1133
1134 class AwsKinesisFailureReason(proto.Message):
1135 r"""Failure when ingesting from an AWS Kinesis source.
1136
1137 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1138
1139 Attributes:
1140 stream_arn (str):
1141 Optional. The stream ARN of the Kinesis
1142 stream being ingested from.
1143 partition_key (str):
1144 Optional. The partition key of the message
1145 that failed to be ingested.
1146 sequence_number (str):
1147 Optional. The sequence number of the message
1148 that failed to be ingested.
1149 schema_violation_reason (google.pubsub_v1.types.IngestionFailureEvent.SchemaViolationReason):
1150 Optional. The Pub/Sub message failed schema
1151 validation.
1152
1153 This field is a member of `oneof`_ ``reason``.
1154 """
1155
1156 stream_arn: str = proto.Field(
1157 proto.STRING,
1158 number=1,
1159 )
1160 partition_key: str = proto.Field(
1161 proto.STRING,
1162 number=2,
1163 )
1164 sequence_number: str = proto.Field(
1165 proto.STRING,
1166 number=3,
1167 )
1168 schema_violation_reason: "IngestionFailureEvent.SchemaViolationReason" = (
1169 proto.Field(
1170 proto.MESSAGE,
1171 number=4,
1172 oneof="reason",
1173 message="IngestionFailureEvent.SchemaViolationReason",
1174 )
1175 )
1176
1177 topic: str = proto.Field(
1178 proto.STRING,
1179 number=1,
1180 )
1181 error_message: str = proto.Field(
1182 proto.STRING,
1183 number=2,
1184 )
1185 cloud_storage_failure: CloudStorageFailure = proto.Field(
1186 proto.MESSAGE,
1187 number=3,
1188 oneof="failure",
1189 message=CloudStorageFailure,
1190 )
1191 aws_msk_failure: AwsMskFailureReason = proto.Field(
1192 proto.MESSAGE,
1193 number=4,
1194 oneof="failure",
1195 message=AwsMskFailureReason,
1196 )
1197 azure_event_hubs_failure: AzureEventHubsFailureReason = proto.Field(
1198 proto.MESSAGE,
1199 number=5,
1200 oneof="failure",
1201 message=AzureEventHubsFailureReason,
1202 )
1203 confluent_cloud_failure: ConfluentCloudFailureReason = proto.Field(
1204 proto.MESSAGE,
1205 number=6,
1206 oneof="failure",
1207 message=ConfluentCloudFailureReason,
1208 )
1209 aws_kinesis_failure: AwsKinesisFailureReason = proto.Field(
1210 proto.MESSAGE,
1211 number=7,
1212 oneof="failure",
1213 message=AwsKinesisFailureReason,
1214 )
1215
1216
1217class JavaScriptUDF(proto.Message):
1218 r"""User-defined JavaScript function that can transform or filter
1219 a Pub/Sub message.
1220
1221 Attributes:
1222 function_name (str):
1223 Required. Name of the JavasScript function
1224 that should applied to Pub/Sub messages.
1225 code (str):
1226 Required. JavaScript code that contains a function
1227 ``function_name`` with the below signature:
1228
1229 ::
1230
1231 /**
1232 * Transforms a Pub/Sub message.
1233
1234 * @return {(Object<string, (string | Object<string, string>)>|null)} - To
1235 * filter a message, return `null`. To transform a message return a map
1236 * with the following keys:
1237 * - (required) 'data' : {string}
1238 * - (optional) 'attributes' : {Object<string, string>}
1239 * Returning empty `attributes` will remove all attributes from the
1240 * message.
1241 *
1242 * @param {(Object<string, (string | Object<string, string>)>} Pub/Sub
1243 * message. Keys:
1244 * - (required) 'data' : {string}
1245 * - (required) 'attributes' : {Object<string, string>}
1246 *
1247 * @param {Object<string, any>} metadata - Pub/Sub message metadata.
1248 * Keys:
1249 * - (optional) 'message_id' : {string}
1250 * - (optional) 'publish_time': {string} YYYY-MM-DDTHH:MM:SSZ format
1251 * - (optional) 'ordering_key': {string}
1252 */
1253
1254 function <function_name>(message, metadata) {
1255 }
1256 """
1257
1258 function_name: str = proto.Field(
1259 proto.STRING,
1260 number=1,
1261 )
1262 code: str = proto.Field(
1263 proto.STRING,
1264 number=2,
1265 )
1266
1267
1268class MessageTransform(proto.Message):
1269 r"""All supported message transforms types.
1270
1271 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
1272
1273 Attributes:
1274 javascript_udf (google.pubsub_v1.types.JavaScriptUDF):
1275 Optional. JavaScript User Defined Function. If multiple
1276 JavaScriptUDF's are specified on a resource, each must have
1277 a unique ``function_name``.
1278
1279 This field is a member of `oneof`_ ``transform``.
1280 enabled (bool):
1281 Optional. This field is deprecated, use the ``disabled``
1282 field to disable transforms.
1283 disabled (bool):
1284 Optional. If true, the transform is disabled and will not be
1285 applied to messages. Defaults to ``false``.
1286 """
1287
1288 javascript_udf: "JavaScriptUDF" = proto.Field(
1289 proto.MESSAGE,
1290 number=2,
1291 oneof="transform",
1292 message="JavaScriptUDF",
1293 )
1294 enabled: bool = proto.Field(
1295 proto.BOOL,
1296 number=3,
1297 )
1298 disabled: bool = proto.Field(
1299 proto.BOOL,
1300 number=4,
1301 )
1302
1303
1304class Topic(proto.Message):
1305 r"""A topic resource.
1306
1307 Attributes:
1308 name (str):
1309 Required. The name of the topic. It must have the format
1310 ``"projects/{project}/topics/{topic}"``. ``{topic}`` must
1311 start with a letter, and contain only letters
1312 (``[A-Za-z]``), numbers (``[0-9]``), dashes (``-``),
1313 underscores (``_``), periods (``.``), tildes (``~``), plus
1314 (``+``) or percent signs (``%``). It must be between 3 and
1315 255 characters in length, and it must not start with
1316 ``"goog"``.
1317 labels (MutableMapping[str, str]):
1318 Optional. See [Creating and managing labels]
1319 (https://cloud.google.com/pubsub/docs/labels).
1320 message_storage_policy (google.pubsub_v1.types.MessageStoragePolicy):
1321 Optional. Policy constraining the set of
1322 Google Cloud Platform regions where messages
1323 published to the topic may be stored. If not
1324 present, then no constraints are in effect.
1325 kms_key_name (str):
1326 Optional. The resource name of the Cloud KMS CryptoKey to be
1327 used to protect access to messages published on this topic.
1328
1329 The expected format is
1330 ``projects/*/locations/*/keyRings/*/cryptoKeys/*``.
1331 schema_settings (google.pubsub_v1.types.SchemaSettings):
1332 Optional. Settings for validating messages
1333 published against a schema.
1334 satisfies_pzs (bool):
1335 Optional. Reserved for future use. This field
1336 is set only in responses from the server; it is
1337 ignored if it is set in any requests.
1338 message_retention_duration (google.protobuf.duration_pb2.Duration):
1339 Optional. Indicates the minimum duration to retain a message
1340 after it is published to the topic. If this field is set,
1341 messages published to the topic in the last
1342 ``message_retention_duration`` are always available to
1343 subscribers. For instance, it allows any attached
1344 subscription to `seek to a
1345 timestamp <https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>`__
1346 that is up to ``message_retention_duration`` in the past. If
1347 this field is not set, message retention is controlled by
1348 settings on individual subscriptions. Cannot be more than 31
1349 days or less than 10 minutes.
1350 state (google.pubsub_v1.types.Topic.State):
1351 Output only. An output-only field indicating
1352 the state of the topic.
1353 ingestion_data_source_settings (google.pubsub_v1.types.IngestionDataSourceSettings):
1354 Optional. Settings for ingestion from a data
1355 source into this topic.
1356 message_transforms (MutableSequence[google.pubsub_v1.types.MessageTransform]):
1357 Optional. Transforms to be applied to
1358 messages published to the topic. Transforms are
1359 applied in the order specified.
1360 """
1361
1362 class State(proto.Enum):
1363 r"""The state of the topic.
1364
1365 Values:
1366 STATE_UNSPECIFIED (0):
1367 Default value. This value is unused.
1368 ACTIVE (1):
1369 The topic does not have any persistent
1370 errors.
1371 INGESTION_RESOURCE_ERROR (2):
1372 Ingestion from the data source has
1373 encountered a permanent error. See the more
1374 detailed error state in the corresponding
1375 ingestion source configuration.
1376 """
1377 STATE_UNSPECIFIED = 0
1378 ACTIVE = 1
1379 INGESTION_RESOURCE_ERROR = 2
1380
1381 name: str = proto.Field(
1382 proto.STRING,
1383 number=1,
1384 )
1385 labels: MutableMapping[str, str] = proto.MapField(
1386 proto.STRING,
1387 proto.STRING,
1388 number=2,
1389 )
1390 message_storage_policy: "MessageStoragePolicy" = proto.Field(
1391 proto.MESSAGE,
1392 number=3,
1393 message="MessageStoragePolicy",
1394 )
1395 kms_key_name: str = proto.Field(
1396 proto.STRING,
1397 number=5,
1398 )
1399 schema_settings: "SchemaSettings" = proto.Field(
1400 proto.MESSAGE,
1401 number=6,
1402 message="SchemaSettings",
1403 )
1404 satisfies_pzs: bool = proto.Field(
1405 proto.BOOL,
1406 number=7,
1407 )
1408 message_retention_duration: duration_pb2.Duration = proto.Field(
1409 proto.MESSAGE,
1410 number=8,
1411 message=duration_pb2.Duration,
1412 )
1413 state: State = proto.Field(
1414 proto.ENUM,
1415 number=9,
1416 enum=State,
1417 )
1418 ingestion_data_source_settings: "IngestionDataSourceSettings" = proto.Field(
1419 proto.MESSAGE,
1420 number=10,
1421 message="IngestionDataSourceSettings",
1422 )
1423 message_transforms: MutableSequence["MessageTransform"] = proto.RepeatedField(
1424 proto.MESSAGE,
1425 number=13,
1426 message="MessageTransform",
1427 )
1428
1429
1430class PubsubMessage(proto.Message):
1431 r"""A message that is published by publishers and consumed by
1432 subscribers. The message must contain either a non-empty data field
1433 or at least one attribute. Note that client libraries represent this
1434 object differently depending on the language. See the corresponding
1435 `client library
1436 documentation <https://cloud.google.com/pubsub/docs/reference/libraries>`__
1437 for more information. See [quotas and limits]
1438 (https://cloud.google.com/pubsub/quotas) for more information about
1439 message limits.
1440
1441 Attributes:
1442 data (bytes):
1443 Optional. The message data field. If this
1444 field is empty, the message must contain at
1445 least one attribute.
1446 attributes (MutableMapping[str, str]):
1447 Optional. Attributes for this message. If
1448 this field is empty, the message must contain
1449 non-empty data. This can be used to filter
1450 messages on the subscription.
1451 message_id (str):
1452 ID of this message, assigned by the server when the message
1453 is published. Guaranteed to be unique within the topic. This
1454 value may be read by a subscriber that receives a
1455 ``PubsubMessage`` via a ``Pull`` call or a push delivery. It
1456 must not be populated by the publisher in a ``Publish``
1457 call.
1458 publish_time (google.protobuf.timestamp_pb2.Timestamp):
1459 The time at which the message was published, populated by
1460 the server when it receives the ``Publish`` call. It must
1461 not be populated by the publisher in a ``Publish`` call.
1462 ordering_key (str):
1463 Optional. If non-empty, identifies related messages for
1464 which publish order should be respected. If a
1465 ``Subscription`` has ``enable_message_ordering`` set to
1466 ``true``, messages published with the same non-empty
1467 ``ordering_key`` value will be delivered to subscribers in
1468 the order in which they are received by the Pub/Sub system.
1469 All ``PubsubMessage``\ s published in a given
1470 ``PublishRequest`` must specify the same ``ordering_key``
1471 value. For more information, see `ordering
1472 messages <https://cloud.google.com/pubsub/docs/ordering>`__.
1473 """
1474
1475 data: bytes = proto.Field(
1476 proto.BYTES,
1477 number=1,
1478 )
1479 attributes: MutableMapping[str, str] = proto.MapField(
1480 proto.STRING,
1481 proto.STRING,
1482 number=2,
1483 )
1484 message_id: str = proto.Field(
1485 proto.STRING,
1486 number=3,
1487 )
1488 publish_time: timestamp_pb2.Timestamp = proto.Field(
1489 proto.MESSAGE,
1490 number=4,
1491 message=timestamp_pb2.Timestamp,
1492 )
1493 ordering_key: str = proto.Field(
1494 proto.STRING,
1495 number=5,
1496 )
1497
1498
1499class GetTopicRequest(proto.Message):
1500 r"""Request for the GetTopic method.
1501
1502 Attributes:
1503 topic (str):
1504 Required. The name of the topic to get. Format is
1505 ``projects/{project}/topics/{topic}``.
1506 """
1507
1508 topic: str = proto.Field(
1509 proto.STRING,
1510 number=1,
1511 )
1512
1513
1514class UpdateTopicRequest(proto.Message):
1515 r"""Request for the UpdateTopic method.
1516
1517 Attributes:
1518 topic (google.pubsub_v1.types.Topic):
1519 Required. The updated topic object.
1520 update_mask (google.protobuf.field_mask_pb2.FieldMask):
1521 Required. Indicates which fields in the provided topic to
1522 update. Must be specified and non-empty. Note that if
1523 ``update_mask`` contains "message_storage_policy" but the
1524 ``message_storage_policy`` is not set in the ``topic``
1525 provided above, then the updated value is determined by the
1526 policy configured at the project or organization level.
1527 """
1528
1529 topic: "Topic" = proto.Field(
1530 proto.MESSAGE,
1531 number=1,
1532 message="Topic",
1533 )
1534 update_mask: field_mask_pb2.FieldMask = proto.Field(
1535 proto.MESSAGE,
1536 number=2,
1537 message=field_mask_pb2.FieldMask,
1538 )
1539
1540
1541class PublishRequest(proto.Message):
1542 r"""Request for the Publish method.
1543
1544 Attributes:
1545 topic (str):
1546 Required. The messages in the request will be published on
1547 this topic. Format is ``projects/{project}/topics/{topic}``.
1548 messages (MutableSequence[google.pubsub_v1.types.PubsubMessage]):
1549 Required. The messages to publish.
1550 """
1551
1552 topic: str = proto.Field(
1553 proto.STRING,
1554 number=1,
1555 )
1556 messages: MutableSequence["PubsubMessage"] = proto.RepeatedField(
1557 proto.MESSAGE,
1558 number=2,
1559 message="PubsubMessage",
1560 )
1561
1562
1563class PublishResponse(proto.Message):
1564 r"""Response for the ``Publish`` method.
1565
1566 Attributes:
1567 message_ids (MutableSequence[str]):
1568 Optional. The server-assigned ID of each
1569 published message, in the same order as the
1570 messages in the request. IDs are guaranteed to
1571 be unique within the topic.
1572 """
1573
1574 message_ids: MutableSequence[str] = proto.RepeatedField(
1575 proto.STRING,
1576 number=1,
1577 )
1578
1579
1580class ListTopicsRequest(proto.Message):
1581 r"""Request for the ``ListTopics`` method.
1582
1583 Attributes:
1584 project (str):
1585 Required. The name of the project in which to list topics.
1586 Format is ``projects/{project-id}``.
1587 page_size (int):
1588 Optional. Maximum number of topics to return.
1589 page_token (str):
1590 Optional. The value returned by the last
1591 ``ListTopicsResponse``; indicates that this is a
1592 continuation of a prior ``ListTopics`` call, and that the
1593 system should return the next page of data.
1594 """
1595
1596 project: str = proto.Field(
1597 proto.STRING,
1598 number=1,
1599 )
1600 page_size: int = proto.Field(
1601 proto.INT32,
1602 number=2,
1603 )
1604 page_token: str = proto.Field(
1605 proto.STRING,
1606 number=3,
1607 )
1608
1609
1610class ListTopicsResponse(proto.Message):
1611 r"""Response for the ``ListTopics`` method.
1612
1613 Attributes:
1614 topics (MutableSequence[google.pubsub_v1.types.Topic]):
1615 Optional. The resulting topics.
1616 next_page_token (str):
1617 Optional. If not empty, indicates that there may be more
1618 topics that match the request; this value should be passed
1619 in a new ``ListTopicsRequest``.
1620 """
1621
1622 @property
1623 def raw_page(self):
1624 return self
1625
1626 topics: MutableSequence["Topic"] = proto.RepeatedField(
1627 proto.MESSAGE,
1628 number=1,
1629 message="Topic",
1630 )
1631 next_page_token: str = proto.Field(
1632 proto.STRING,
1633 number=2,
1634 )
1635
1636
1637class ListTopicSubscriptionsRequest(proto.Message):
1638 r"""Request for the ``ListTopicSubscriptions`` method.
1639
1640 Attributes:
1641 topic (str):
1642 Required. The name of the topic that subscriptions are
1643 attached to. Format is
1644 ``projects/{project}/topics/{topic}``.
1645 page_size (int):
1646 Optional. Maximum number of subscription
1647 names to return.
1648 page_token (str):
1649 Optional. The value returned by the last
1650 ``ListTopicSubscriptionsResponse``; indicates that this is a
1651 continuation of a prior ``ListTopicSubscriptions`` call, and
1652 that the system should return the next page of data.
1653 """
1654
1655 topic: str = proto.Field(
1656 proto.STRING,
1657 number=1,
1658 )
1659 page_size: int = proto.Field(
1660 proto.INT32,
1661 number=2,
1662 )
1663 page_token: str = proto.Field(
1664 proto.STRING,
1665 number=3,
1666 )
1667
1668
1669class ListTopicSubscriptionsResponse(proto.Message):
1670 r"""Response for the ``ListTopicSubscriptions`` method.
1671
1672 Attributes:
1673 subscriptions (MutableSequence[str]):
1674 Optional. The names of subscriptions attached
1675 to the topic specified in the request.
1676 next_page_token (str):
1677 Optional. If not empty, indicates that there may be more
1678 subscriptions that match the request; this value should be
1679 passed in a new ``ListTopicSubscriptionsRequest`` to get
1680 more subscriptions.
1681 """
1682
1683 @property
1684 def raw_page(self):
1685 return self
1686
1687 subscriptions: MutableSequence[str] = proto.RepeatedField(
1688 proto.STRING,
1689 number=1,
1690 )
1691 next_page_token: str = proto.Field(
1692 proto.STRING,
1693 number=2,
1694 )
1695
1696
1697class ListTopicSnapshotsRequest(proto.Message):
1698 r"""Request for the ``ListTopicSnapshots`` method.
1699
1700 Attributes:
1701 topic (str):
1702 Required. The name of the topic that snapshots are attached
1703 to. Format is ``projects/{project}/topics/{topic}``.
1704 page_size (int):
1705 Optional. Maximum number of snapshot names to
1706 return.
1707 page_token (str):
1708 Optional. The value returned by the last
1709 ``ListTopicSnapshotsResponse``; indicates that this is a
1710 continuation of a prior ``ListTopicSnapshots`` call, and
1711 that the system should return the next page of data.
1712 """
1713
1714 topic: str = proto.Field(
1715 proto.STRING,
1716 number=1,
1717 )
1718 page_size: int = proto.Field(
1719 proto.INT32,
1720 number=2,
1721 )
1722 page_token: str = proto.Field(
1723 proto.STRING,
1724 number=3,
1725 )
1726
1727
1728class ListTopicSnapshotsResponse(proto.Message):
1729 r"""Response for the ``ListTopicSnapshots`` method.
1730
1731 Attributes:
1732 snapshots (MutableSequence[str]):
1733 Optional. The names of the snapshots that
1734 match the request.
1735 next_page_token (str):
1736 Optional. If not empty, indicates that there may be more
1737 snapshots that match the request; this value should be
1738 passed in a new ``ListTopicSnapshotsRequest`` to get more
1739 snapshots.
1740 """
1741
1742 @property
1743 def raw_page(self):
1744 return self
1745
1746 snapshots: MutableSequence[str] = proto.RepeatedField(
1747 proto.STRING,
1748 number=1,
1749 )
1750 next_page_token: str = proto.Field(
1751 proto.STRING,
1752 number=2,
1753 )
1754
1755
1756class DeleteTopicRequest(proto.Message):
1757 r"""Request for the ``DeleteTopic`` method.
1758
1759 Attributes:
1760 topic (str):
1761 Required. Name of the topic to delete. Format is
1762 ``projects/{project}/topics/{topic}``.
1763 """
1764
1765 topic: str = proto.Field(
1766 proto.STRING,
1767 number=1,
1768 )
1769
1770
1771class DetachSubscriptionRequest(proto.Message):
1772 r"""Request for the DetachSubscription method.
1773
1774 Attributes:
1775 subscription (str):
1776 Required. The subscription to detach. Format is
1777 ``projects/{project}/subscriptions/{subscription}``.
1778 """
1779
1780 subscription: str = proto.Field(
1781 proto.STRING,
1782 number=1,
1783 )
1784
1785
1786class DetachSubscriptionResponse(proto.Message):
1787 r"""Response for the DetachSubscription method.
1788 Reserved for future use.
1789
1790 """
1791
1792
1793class Subscription(proto.Message):
1794 r"""A subscription resource. If none of ``push_config``,
1795 ``bigquery_config``, or ``cloud_storage_config`` is set, then the
1796 subscriber will pull and ack messages using API methods. At most one
1797 of these fields may be set.
1798
1799 Attributes:
1800 name (str):
1801 Required. The name of the subscription. It must have the
1802 format
1803 ``"projects/{project}/subscriptions/{subscription}"``.
1804 ``{subscription}`` must start with a letter, and contain
1805 only letters (``[A-Za-z]``), numbers (``[0-9]``), dashes
1806 (``-``), underscores (``_``), periods (``.``), tildes
1807 (``~``), plus (``+``) or percent signs (``%``). It must be
1808 between 3 and 255 characters in length, and it must not
1809 start with ``"goog"``.
1810 topic (str):
1811 Required. The name of the topic from which this subscription
1812 is receiving messages. Format is
1813 ``projects/{project}/topics/{topic}``. The value of this
1814 field will be ``_deleted-topic_`` if the topic has been
1815 deleted.
1816 push_config (google.pubsub_v1.types.PushConfig):
1817 Optional. If push delivery is used with this
1818 subscription, this field is used to configure
1819 it.
1820 bigquery_config (google.pubsub_v1.types.BigQueryConfig):
1821 Optional. If delivery to BigQuery is used
1822 with this subscription, this field is used to
1823 configure it.
1824 cloud_storage_config (google.pubsub_v1.types.CloudStorageConfig):
1825 Optional. If delivery to Google Cloud Storage
1826 is used with this subscription, this field is
1827 used to configure it.
1828 ack_deadline_seconds (int):
1829 Optional. The approximate amount of time (on a best-effort
1830 basis) Pub/Sub waits for the subscriber to acknowledge
1831 receipt before resending the message. In the interval after
1832 the message is delivered and before it is acknowledged, it
1833 is considered to be *outstanding*. During that time period,
1834 the message will not be redelivered (on a best-effort
1835 basis).
1836
1837 For pull subscriptions, this value is used as the initial
1838 value for the ack deadline. To override this value for a
1839 given message, call ``ModifyAckDeadline`` with the
1840 corresponding ``ack_id`` if using non-streaming pull or send
1841 the ``ack_id`` in a ``StreamingModifyAckDeadlineRequest`` if
1842 using streaming pull. The minimum custom deadline you can
1843 specify is 10 seconds. The maximum custom deadline you can
1844 specify is 600 seconds (10 minutes). If this parameter is 0,
1845 a default value of 10 seconds is used.
1846
1847 For push delivery, this value is also used to set the
1848 request timeout for the call to the push endpoint.
1849
1850 If the subscriber never acknowledges the message, the
1851 Pub/Sub system will eventually redeliver the message.
1852 retain_acked_messages (bool):
1853 Optional. Indicates whether to retain acknowledged messages.
1854 If true, then messages are not expunged from the
1855 subscription's backlog, even if they are acknowledged, until
1856 they fall out of the ``message_retention_duration`` window.
1857 This must be true if you would like to [``Seek`` to a
1858 timestamp]
1859 (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
1860 in the past to replay previously-acknowledged messages.
1861 message_retention_duration (google.protobuf.duration_pb2.Duration):
1862 Optional. How long to retain unacknowledged messages in the
1863 subscription's backlog, from the moment a message is
1864 published. If ``retain_acked_messages`` is true, then this
1865 also configures the retention of acknowledged messages, and
1866 thus configures how far back in time a ``Seek`` can be done.
1867 Defaults to 7 days. Cannot be more than 31 days or less than
1868 10 minutes.
1869 labels (MutableMapping[str, str]):
1870 Optional. See `Creating and managing
1871 labels <https://cloud.google.com/pubsub/docs/labels>`__.
1872 enable_message_ordering (bool):
1873 Optional. If true, messages published with the same
1874 ``ordering_key`` in ``PubsubMessage`` will be delivered to
1875 the subscribers in the order in which they are received by
1876 the Pub/Sub system. Otherwise, they may be delivered in any
1877 order.
1878 expiration_policy (google.pubsub_v1.types.ExpirationPolicy):
1879 Optional. A policy that specifies the conditions for this
1880 subscription's expiration. A subscription is considered
1881 active as long as any connected subscriber is successfully
1882 consuming messages from the subscription or is issuing
1883 operations on the subscription. If ``expiration_policy`` is
1884 not set, a *default policy* with ``ttl`` of 31 days will be
1885 used. The minimum allowed value for
1886 ``expiration_policy.ttl`` is 1 day. If ``expiration_policy``
1887 is set, but ``expiration_policy.ttl`` is not set, the
1888 subscription never expires.
1889 filter (str):
1890 Optional. An expression written in the Pub/Sub `filter
1891 language <https://cloud.google.com/pubsub/docs/filtering>`__.
1892 If non-empty, then only ``PubsubMessage``\ s whose
1893 ``attributes`` field matches the filter are delivered on
1894 this subscription. If empty, then no messages are filtered
1895 out.
1896 dead_letter_policy (google.pubsub_v1.types.DeadLetterPolicy):
1897 Optional. A policy that specifies the conditions for dead
1898 lettering messages in this subscription. If
1899 dead_letter_policy is not set, dead lettering is disabled.
1900
1901 The Pub/Sub service account associated with this
1902 subscriptions's parent project (i.e.,
1903 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com)
1904 must have permission to Acknowledge() messages on this
1905 subscription.
1906 retry_policy (google.pubsub_v1.types.RetryPolicy):
1907 Optional. A policy that specifies how Pub/Sub
1908 retries message delivery for this subscription.
1909
1910 If not set, the default retry policy is applied.
1911 This generally implies that messages will be
1912 retried as soon as possible for healthy
1913 subscribers. RetryPolicy will be triggered on
1914 NACKs or acknowledgment deadline exceeded events
1915 for a given message.
1916 detached (bool):
1917 Optional. Indicates whether the subscription is detached
1918 from its topic. Detached subscriptions don't receive
1919 messages from their topic and don't retain any backlog.
1920 ``Pull`` and ``StreamingPull`` requests will return
1921 FAILED_PRECONDITION. If the subscription is a push
1922 subscription, pushes to the endpoint will not be made.
1923 enable_exactly_once_delivery (bool):
1924 Optional. If true, Pub/Sub provides the following guarantees
1925 for the delivery of a message with a given value of
1926 ``message_id`` on this subscription:
1927
1928 - The message sent to a subscriber is guaranteed not to be
1929 resent before the message's acknowledgment deadline
1930 expires.
1931 - An acknowledged message will not be resent to a
1932 subscriber.
1933
1934 Note that subscribers may still receive multiple copies of a
1935 message when ``enable_exactly_once_delivery`` is true if the
1936 message was published multiple times by a publisher client.
1937 These copies are considered distinct by Pub/Sub and have
1938 distinct ``message_id`` values.
1939 topic_message_retention_duration (google.protobuf.duration_pb2.Duration):
1940 Output only. Indicates the minimum duration for which a
1941 message is retained after it is published to the
1942 subscription's topic. If this field is set, messages
1943 published to the subscription's topic in the last
1944 ``topic_message_retention_duration`` are always available to
1945 subscribers. See the ``message_retention_duration`` field in
1946 ``Topic``. This field is set only in responses from the
1947 server; it is ignored if it is set in any requests.
1948 state (google.pubsub_v1.types.Subscription.State):
1949 Output only. An output-only field indicating
1950 whether or not the subscription can receive
1951 messages.
1952 analytics_hub_subscription_info (google.pubsub_v1.types.Subscription.AnalyticsHubSubscriptionInfo):
1953 Output only. Information about the associated
1954 Analytics Hub subscription. Only set if the
1955 subscritpion is created by Analytics Hub.
1956 message_transforms (MutableSequence[google.pubsub_v1.types.MessageTransform]):
1957 Optional. Transforms to be applied to
1958 messages before they are delivered to
1959 subscribers. Transforms are applied in the order
1960 specified.
1961 """
1962
1963 class State(proto.Enum):
1964 r"""Possible states for a subscription.
1965
1966 Values:
1967 STATE_UNSPECIFIED (0):
1968 Default value. This value is unused.
1969 ACTIVE (1):
1970 The subscription can actively receive
1971 messages
1972 RESOURCE_ERROR (2):
1973 The subscription cannot receive messages
1974 because of an error with the resource to which
1975 it pushes messages. See the more detailed error
1976 state in the corresponding configuration.
1977 """
1978 STATE_UNSPECIFIED = 0
1979 ACTIVE = 1
1980 RESOURCE_ERROR = 2
1981
1982 class AnalyticsHubSubscriptionInfo(proto.Message):
1983 r"""Information about an associated `Analytics Hub
1984 subscription <https://cloud.google.com/bigquery/docs/analytics-hub-manage-subscriptions>`__.
1985
1986 Attributes:
1987 listing (str):
1988 Optional. The name of the associated Analytics Hub listing
1989 resource. Pattern:
1990 "projects/{project}/locations/{location}/dataExchanges/{data_exchange}/listings/{listing}".
1991 subscription (str):
1992 Optional. The name of the associated
1993 Analytics Hub subscription resource. Pattern:
1994
1995 "projects/{project}/locations/{location}/subscriptions/{subscription}".
1996 """
1997
1998 listing: str = proto.Field(
1999 proto.STRING,
2000 number=1,
2001 )
2002 subscription: str = proto.Field(
2003 proto.STRING,
2004 number=2,
2005 )
2006
2007 name: str = proto.Field(
2008 proto.STRING,
2009 number=1,
2010 )
2011 topic: str = proto.Field(
2012 proto.STRING,
2013 number=2,
2014 )
2015 push_config: "PushConfig" = proto.Field(
2016 proto.MESSAGE,
2017 number=4,
2018 message="PushConfig",
2019 )
2020 bigquery_config: "BigQueryConfig" = proto.Field(
2021 proto.MESSAGE,
2022 number=18,
2023 message="BigQueryConfig",
2024 )
2025 cloud_storage_config: "CloudStorageConfig" = proto.Field(
2026 proto.MESSAGE,
2027 number=22,
2028 message="CloudStorageConfig",
2029 )
2030 ack_deadline_seconds: int = proto.Field(
2031 proto.INT32,
2032 number=5,
2033 )
2034 retain_acked_messages: bool = proto.Field(
2035 proto.BOOL,
2036 number=7,
2037 )
2038 message_retention_duration: duration_pb2.Duration = proto.Field(
2039 proto.MESSAGE,
2040 number=8,
2041 message=duration_pb2.Duration,
2042 )
2043 labels: MutableMapping[str, str] = proto.MapField(
2044 proto.STRING,
2045 proto.STRING,
2046 number=9,
2047 )
2048 enable_message_ordering: bool = proto.Field(
2049 proto.BOOL,
2050 number=10,
2051 )
2052 expiration_policy: "ExpirationPolicy" = proto.Field(
2053 proto.MESSAGE,
2054 number=11,
2055 message="ExpirationPolicy",
2056 )
2057 filter: str = proto.Field(
2058 proto.STRING,
2059 number=12,
2060 )
2061 dead_letter_policy: "DeadLetterPolicy" = proto.Field(
2062 proto.MESSAGE,
2063 number=13,
2064 message="DeadLetterPolicy",
2065 )
2066 retry_policy: "RetryPolicy" = proto.Field(
2067 proto.MESSAGE,
2068 number=14,
2069 message="RetryPolicy",
2070 )
2071 detached: bool = proto.Field(
2072 proto.BOOL,
2073 number=15,
2074 )
2075 enable_exactly_once_delivery: bool = proto.Field(
2076 proto.BOOL,
2077 number=16,
2078 )
2079 topic_message_retention_duration: duration_pb2.Duration = proto.Field(
2080 proto.MESSAGE,
2081 number=17,
2082 message=duration_pb2.Duration,
2083 )
2084 state: State = proto.Field(
2085 proto.ENUM,
2086 number=19,
2087 enum=State,
2088 )
2089 analytics_hub_subscription_info: AnalyticsHubSubscriptionInfo = proto.Field(
2090 proto.MESSAGE,
2091 number=23,
2092 message=AnalyticsHubSubscriptionInfo,
2093 )
2094 message_transforms: MutableSequence["MessageTransform"] = proto.RepeatedField(
2095 proto.MESSAGE,
2096 number=25,
2097 message="MessageTransform",
2098 )
2099
2100
2101class RetryPolicy(proto.Message):
2102 r"""A policy that specifies how Pub/Sub retries message delivery.
2103
2104 Retry delay will be exponential based on provided minimum and
2105 maximum backoffs. https://en.wikipedia.org/wiki/Exponential_backoff.
2106
2107 RetryPolicy will be triggered on NACKs or acknowledgment deadline
2108 exceeded events for a given message.
2109
2110 Retry Policy is implemented on a best effort basis. At times, the
2111 delay between consecutive deliveries may not match the
2112 configuration. That is, delay can be more or less than configured
2113 backoff.
2114
2115 Attributes:
2116 minimum_backoff (google.protobuf.duration_pb2.Duration):
2117 Optional. The minimum delay between
2118 consecutive deliveries of a given message. Value
2119 should be between 0 and 600 seconds. Defaults to
2120 10 seconds.
2121 maximum_backoff (google.protobuf.duration_pb2.Duration):
2122 Optional. The maximum delay between
2123 consecutive deliveries of a given message. Value
2124 should be between 0 and 600 seconds. Defaults to
2125 600 seconds.
2126 """
2127
2128 minimum_backoff: duration_pb2.Duration = proto.Field(
2129 proto.MESSAGE,
2130 number=1,
2131 message=duration_pb2.Duration,
2132 )
2133 maximum_backoff: duration_pb2.Duration = proto.Field(
2134 proto.MESSAGE,
2135 number=2,
2136 message=duration_pb2.Duration,
2137 )
2138
2139
2140class DeadLetterPolicy(proto.Message):
2141 r"""Dead lettering is done on a best effort basis. The same
2142 message might be dead lettered multiple times.
2143
2144 If validation on any of the fields fails at subscription
2145 creation/updation, the create/update subscription request will
2146 fail.
2147
2148 Attributes:
2149 dead_letter_topic (str):
2150 Optional. The name of the topic to which dead letter
2151 messages should be published. Format is
2152 ``projects/{project}/topics/{topic}``.The Pub/Sub service
2153 account associated with the enclosing subscription's parent
2154 project (i.e.,
2155 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com)
2156 must have permission to Publish() to this topic.
2157
2158 The operation will fail if the topic does not exist. Users
2159 should ensure that there is a subscription attached to this
2160 topic since messages published to a topic with no
2161 subscriptions are lost.
2162 max_delivery_attempts (int):
2163 Optional. The maximum number of delivery attempts for any
2164 message. The value must be between 5 and 100.
2165
2166 The number of delivery attempts is defined as 1 + (the sum
2167 of number of NACKs and number of times the acknowledgment
2168 deadline has been exceeded for the message).
2169
2170 A NACK is any call to ModifyAckDeadline with a 0 deadline.
2171 Note that client libraries may automatically extend
2172 ack_deadlines.
2173
2174 This field will be honored on a best effort basis.
2175
2176 If this parameter is 0, a default value of 5 is used.
2177 """
2178
2179 dead_letter_topic: str = proto.Field(
2180 proto.STRING,
2181 number=1,
2182 )
2183 max_delivery_attempts: int = proto.Field(
2184 proto.INT32,
2185 number=2,
2186 )
2187
2188
2189class ExpirationPolicy(proto.Message):
2190 r"""A policy that specifies the conditions for resource
2191 expiration (i.e., automatic resource deletion).
2192
2193 Attributes:
2194 ttl (google.protobuf.duration_pb2.Duration):
2195 Optional. Specifies the "time-to-live" duration for an
2196 associated resource. The resource expires if it is not
2197 active for a period of ``ttl``. The definition of "activity"
2198 depends on the type of the associated resource. The minimum
2199 and maximum allowed values for ``ttl`` depend on the type of
2200 the associated resource, as well. If ``ttl`` is not set, the
2201 associated resource never expires.
2202 """
2203
2204 ttl: duration_pb2.Duration = proto.Field(
2205 proto.MESSAGE,
2206 number=1,
2207 message=duration_pb2.Duration,
2208 )
2209
2210
2211class PushConfig(proto.Message):
2212 r"""Configuration for a push delivery endpoint.
2213
2214 This message has `oneof`_ fields (mutually exclusive fields).
2215 For each oneof, at most one member field can be set at the same time.
2216 Setting any member of the oneof automatically clears all other
2217 members.
2218
2219 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2220
2221 Attributes:
2222 push_endpoint (str):
2223 Optional. A URL locating the endpoint to which messages
2224 should be pushed. For example, a Webhook endpoint might use
2225 ``https://example.com/push``.
2226 attributes (MutableMapping[str, str]):
2227 Optional. Endpoint configuration attributes that can be used
2228 to control different aspects of the message delivery.
2229
2230 The only currently supported attribute is
2231 ``x-goog-version``, which you can use to change the format
2232 of the pushed message. This attribute indicates the version
2233 of the data expected by the endpoint. This controls the
2234 shape of the pushed message (i.e., its fields and metadata).
2235
2236 If not present during the ``CreateSubscription`` call, it
2237 will default to the version of the Pub/Sub API used to make
2238 such call. If not present in a ``ModifyPushConfig`` call,
2239 its value will not be changed. ``GetSubscription`` calls
2240 will always return a valid version, even if the subscription
2241 was created without this attribute.
2242
2243 The only supported values for the ``x-goog-version``
2244 attribute are:
2245
2246 - ``v1beta1``: uses the push format defined in the v1beta1
2247 Pub/Sub API.
2248 - ``v1`` or ``v1beta2``: uses the push format defined in
2249 the v1 Pub/Sub API.
2250
2251 For example: ``attributes { "x-goog-version": "v1" }``
2252 oidc_token (google.pubsub_v1.types.PushConfig.OidcToken):
2253 Optional. If specified, Pub/Sub will generate and attach an
2254 OIDC JWT token as an ``Authorization`` header in the HTTP
2255 request for every pushed message.
2256
2257 This field is a member of `oneof`_ ``authentication_method``.
2258 pubsub_wrapper (google.pubsub_v1.types.PushConfig.PubsubWrapper):
2259 Optional. When set, the payload to the push
2260 endpoint is in the form of the JSON
2261 representation of a PubsubMessage
2262 (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
2263
2264 This field is a member of `oneof`_ ``wrapper``.
2265 no_wrapper (google.pubsub_v1.types.PushConfig.NoWrapper):
2266 Optional. When set, the payload to the push
2267 endpoint is not wrapped.
2268
2269 This field is a member of `oneof`_ ``wrapper``.
2270 """
2271
2272 class OidcToken(proto.Message):
2273 r"""Contains information needed for generating an `OpenID Connect
2274 token <https://developers.google.com/identity/protocols/OpenIDConnect>`__.
2275
2276 Attributes:
2277 service_account_email (str):
2278 Optional. `Service account
2279 email <https://cloud.google.com/iam/docs/service-accounts>`__
2280 used for generating the OIDC token. For more information on
2281 setting up authentication, see `Push
2282 subscriptions <https://cloud.google.com/pubsub/docs/push>`__.
2283 audience (str):
2284 Optional. Audience to be used when generating
2285 OIDC token. The audience claim identifies the
2286 recipients that the JWT is intended for. The
2287 audience value is a single case-sensitive
2288 string. Having multiple values (array) for the
2289 audience field is not supported. More info about
2290 the OIDC JWT token audience here:
2291
2292 https://tools.ietf.org/html/rfc7519#section-4.1.3
2293 Note: if not specified, the Push endpoint URL
2294 will be used.
2295 """
2296
2297 service_account_email: str = proto.Field(
2298 proto.STRING,
2299 number=1,
2300 )
2301 audience: str = proto.Field(
2302 proto.STRING,
2303 number=2,
2304 )
2305
2306 class PubsubWrapper(proto.Message):
2307 r"""The payload to the push endpoint is in the form of the JSON
2308 representation of a PubsubMessage
2309 (https://cloud.google.com/pubsub/docs/reference/rpc/google.pubsub.v1#pubsubmessage).
2310
2311 """
2312
2313 class NoWrapper(proto.Message):
2314 r"""Sets the ``data`` field as the HTTP body for delivery.
2315
2316 Attributes:
2317 write_metadata (bool):
2318 Optional. When true, writes the Pub/Sub message metadata to
2319 ``x-goog-pubsub-<KEY>:<VAL>`` headers of the HTTP request.
2320 Writes the Pub/Sub message attributes to ``<KEY>:<VAL>``
2321 headers of the HTTP request.
2322 """
2323
2324 write_metadata: bool = proto.Field(
2325 proto.BOOL,
2326 number=1,
2327 )
2328
2329 push_endpoint: str = proto.Field(
2330 proto.STRING,
2331 number=1,
2332 )
2333 attributes: MutableMapping[str, str] = proto.MapField(
2334 proto.STRING,
2335 proto.STRING,
2336 number=2,
2337 )
2338 oidc_token: OidcToken = proto.Field(
2339 proto.MESSAGE,
2340 number=3,
2341 oneof="authentication_method",
2342 message=OidcToken,
2343 )
2344 pubsub_wrapper: PubsubWrapper = proto.Field(
2345 proto.MESSAGE,
2346 number=4,
2347 oneof="wrapper",
2348 message=PubsubWrapper,
2349 )
2350 no_wrapper: NoWrapper = proto.Field(
2351 proto.MESSAGE,
2352 number=5,
2353 oneof="wrapper",
2354 message=NoWrapper,
2355 )
2356
2357
2358class BigQueryConfig(proto.Message):
2359 r"""Configuration for a BigQuery subscription.
2360
2361 Attributes:
2362 table (str):
2363 Optional. The name of the table to which to
2364 write data, of the form
2365 {projectId}.{datasetId}.{tableId}
2366 use_topic_schema (bool):
2367 Optional. When true, use the topic's schema as the columns
2368 to write to in BigQuery, if it exists. ``use_topic_schema``
2369 and ``use_table_schema`` cannot be enabled at the same time.
2370 write_metadata (bool):
2371 Optional. When true, write the subscription name,
2372 message_id, publish_time, attributes, and ordering_key to
2373 additional columns in the table. The subscription name,
2374 message_id, and publish_time fields are put in their own
2375 columns while all other message properties (other than data)
2376 are written to a JSON object in the attributes column.
2377 drop_unknown_fields (bool):
2378 Optional. When true and use_topic_schema is true, any fields
2379 that are a part of the topic schema that are not part of the
2380 BigQuery table schema are dropped when writing to BigQuery.
2381 Otherwise, the schemas must be kept in sync and any messages
2382 with extra fields are not written and remain in the
2383 subscription's backlog.
2384 state (google.pubsub_v1.types.BigQueryConfig.State):
2385 Output only. An output-only field that
2386 indicates whether or not the subscription can
2387 receive messages.
2388 use_table_schema (bool):
2389 Optional. When true, use the BigQuery table's schema as the
2390 columns to write to in BigQuery. ``use_table_schema`` and
2391 ``use_topic_schema`` cannot be enabled at the same time.
2392 service_account_email (str):
2393 Optional. The service account to use to write to BigQuery.
2394 The subscription creator or updater that specifies this
2395 field must have ``iam.serviceAccounts.actAs`` permission on
2396 the service account. If not specified, the Pub/Sub `service
2397 agent <https://cloud.google.com/iam/docs/service-agents>`__,
2398 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com,
2399 is used.
2400 """
2401
2402 class State(proto.Enum):
2403 r"""Possible states for a BigQuery subscription.
2404
2405 Values:
2406 STATE_UNSPECIFIED (0):
2407 Default value. This value is unused.
2408 ACTIVE (1):
2409 The subscription can actively send messages
2410 to BigQuery
2411 PERMISSION_DENIED (2):
2412 Cannot write to the BigQuery table because of permission
2413 denied errors. This can happen if
2414
2415 - Pub/Sub SA has not been granted the `appropriate BigQuery
2416 IAM
2417 permissions <https://cloud.google.com/pubsub/docs/create-subscription#assign_bigquery_service_account>`__
2418 - bigquery.googleapis.com API is not enabled for the
2419 project
2420 (`instructions <https://cloud.google.com/service-usage/docs/enable-disable>`__)
2421 NOT_FOUND (3):
2422 Cannot write to the BigQuery table because it
2423 does not exist.
2424 SCHEMA_MISMATCH (4):
2425 Cannot write to the BigQuery table due to a
2426 schema mismatch.
2427 IN_TRANSIT_LOCATION_RESTRICTION (5):
2428 Cannot write to the destination because enforce_in_transit
2429 is set to true and the destination locations are not in the
2430 allowed regions.
2431 """
2432 STATE_UNSPECIFIED = 0
2433 ACTIVE = 1
2434 PERMISSION_DENIED = 2
2435 NOT_FOUND = 3
2436 SCHEMA_MISMATCH = 4
2437 IN_TRANSIT_LOCATION_RESTRICTION = 5
2438
2439 table: str = proto.Field(
2440 proto.STRING,
2441 number=1,
2442 )
2443 use_topic_schema: bool = proto.Field(
2444 proto.BOOL,
2445 number=2,
2446 )
2447 write_metadata: bool = proto.Field(
2448 proto.BOOL,
2449 number=3,
2450 )
2451 drop_unknown_fields: bool = proto.Field(
2452 proto.BOOL,
2453 number=4,
2454 )
2455 state: State = proto.Field(
2456 proto.ENUM,
2457 number=5,
2458 enum=State,
2459 )
2460 use_table_schema: bool = proto.Field(
2461 proto.BOOL,
2462 number=6,
2463 )
2464 service_account_email: str = proto.Field(
2465 proto.STRING,
2466 number=7,
2467 )
2468
2469
2470class CloudStorageConfig(proto.Message):
2471 r"""Configuration for a Cloud Storage subscription.
2472
2473 This message has `oneof`_ fields (mutually exclusive fields).
2474 For each oneof, at most one member field can be set at the same time.
2475 Setting any member of the oneof automatically clears all other
2476 members.
2477
2478 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
2479
2480 Attributes:
2481 bucket (str):
2482 Required. User-provided name for the Cloud Storage bucket.
2483 The bucket must be created by the user. The bucket name must
2484 be without any prefix like "gs://". See the [bucket naming
2485 requirements]
2486 (https://cloud.google.com/storage/docs/buckets#naming).
2487 filename_prefix (str):
2488 Optional. User-provided prefix for Cloud Storage filename.
2489 See the `object naming
2490 requirements <https://cloud.google.com/storage/docs/objects#naming>`__.
2491 filename_suffix (str):
2492 Optional. User-provided suffix for Cloud Storage filename.
2493 See the `object naming
2494 requirements <https://cloud.google.com/storage/docs/objects#naming>`__.
2495 Must not end in "/".
2496 filename_datetime_format (str):
2497 Optional. User-provided format string specifying how to
2498 represent datetimes in Cloud Storage filenames. See the
2499 `datetime format
2500 guidance <https://cloud.google.com/pubsub/docs/create-cloudstorage-subscription#file_names>`__.
2501 text_config (google.pubsub_v1.types.CloudStorageConfig.TextConfig):
2502 Optional. If set, message data will be
2503 written to Cloud Storage in text format.
2504
2505 This field is a member of `oneof`_ ``output_format``.
2506 avro_config (google.pubsub_v1.types.CloudStorageConfig.AvroConfig):
2507 Optional. If set, message data will be
2508 written to Cloud Storage in Avro format.
2509
2510 This field is a member of `oneof`_ ``output_format``.
2511 max_duration (google.protobuf.duration_pb2.Duration):
2512 Optional. The maximum duration that can
2513 elapse before a new Cloud Storage file is
2514 created. Min 1 minute, max 10 minutes, default 5
2515 minutes. May not exceed the subscription's
2516 acknowledgment deadline.
2517 max_bytes (int):
2518 Optional. The maximum bytes that can be written to a Cloud
2519 Storage file before a new file is created. Min 1 KB, max 10
2520 GiB. The max_bytes limit may be exceeded in cases where
2521 messages are larger than the limit.
2522 max_messages (int):
2523 Optional. The maximum number of messages that
2524 can be written to a Cloud Storage file before a
2525 new file is created. Min 1000 messages.
2526 state (google.pubsub_v1.types.CloudStorageConfig.State):
2527 Output only. An output-only field that
2528 indicates whether or not the subscription can
2529 receive messages.
2530 service_account_email (str):
2531 Optional. The service account to use to write to Cloud
2532 Storage. The subscription creator or updater that specifies
2533 this field must have ``iam.serviceAccounts.actAs``
2534 permission on the service account. If not specified, the
2535 Pub/Sub `service
2536 agent <https://cloud.google.com/iam/docs/service-agents>`__,
2537 service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com,
2538 is used.
2539 """
2540
2541 class State(proto.Enum):
2542 r"""Possible states for a Cloud Storage subscription.
2543
2544 Values:
2545 STATE_UNSPECIFIED (0):
2546 Default value. This value is unused.
2547 ACTIVE (1):
2548 The subscription can actively send messages
2549 to Cloud Storage.
2550 PERMISSION_DENIED (2):
2551 Cannot write to the Cloud Storage bucket
2552 because of permission denied errors.
2553 NOT_FOUND (3):
2554 Cannot write to the Cloud Storage bucket
2555 because it does not exist.
2556 IN_TRANSIT_LOCATION_RESTRICTION (4):
2557 Cannot write to the destination because enforce_in_transit
2558 is set to true and the destination locations are not in the
2559 allowed regions.
2560 SCHEMA_MISMATCH (5):
2561 Cannot write to the Cloud Storage bucket due
2562 to an incompatibility between the topic schema
2563 and subscription settings.
2564 """
2565 STATE_UNSPECIFIED = 0
2566 ACTIVE = 1
2567 PERMISSION_DENIED = 2
2568 NOT_FOUND = 3
2569 IN_TRANSIT_LOCATION_RESTRICTION = 4
2570 SCHEMA_MISMATCH = 5
2571
2572 class TextConfig(proto.Message):
2573 r"""Configuration for writing message data in text format.
2574 Message payloads will be written to files as raw text, separated
2575 by a newline.
2576
2577 """
2578
2579 class AvroConfig(proto.Message):
2580 r"""Configuration for writing message data in Avro format.
2581 Message payloads and metadata will be written to files as an
2582 Avro binary.
2583
2584 Attributes:
2585 write_metadata (bool):
2586 Optional. When true, write the subscription name,
2587 message_id, publish_time, attributes, and ordering_key as
2588 additional fields in the output. The subscription name,
2589 message_id, and publish_time fields are put in their own
2590 fields while all other message properties other than data
2591 (for example, an ordering_key, if present) are added as
2592 entries in the attributes map.
2593 use_topic_schema (bool):
2594 Optional. When true, the output Cloud Storage
2595 file will be serialized using the topic schema,
2596 if it exists.
2597 """
2598
2599 write_metadata: bool = proto.Field(
2600 proto.BOOL,
2601 number=1,
2602 )
2603 use_topic_schema: bool = proto.Field(
2604 proto.BOOL,
2605 number=2,
2606 )
2607
2608 bucket: str = proto.Field(
2609 proto.STRING,
2610 number=1,
2611 )
2612 filename_prefix: str = proto.Field(
2613 proto.STRING,
2614 number=2,
2615 )
2616 filename_suffix: str = proto.Field(
2617 proto.STRING,
2618 number=3,
2619 )
2620 filename_datetime_format: str = proto.Field(
2621 proto.STRING,
2622 number=10,
2623 )
2624 text_config: TextConfig = proto.Field(
2625 proto.MESSAGE,
2626 number=4,
2627 oneof="output_format",
2628 message=TextConfig,
2629 )
2630 avro_config: AvroConfig = proto.Field(
2631 proto.MESSAGE,
2632 number=5,
2633 oneof="output_format",
2634 message=AvroConfig,
2635 )
2636 max_duration: duration_pb2.Duration = proto.Field(
2637 proto.MESSAGE,
2638 number=6,
2639 message=duration_pb2.Duration,
2640 )
2641 max_bytes: int = proto.Field(
2642 proto.INT64,
2643 number=7,
2644 )
2645 max_messages: int = proto.Field(
2646 proto.INT64,
2647 number=8,
2648 )
2649 state: State = proto.Field(
2650 proto.ENUM,
2651 number=9,
2652 enum=State,
2653 )
2654 service_account_email: str = proto.Field(
2655 proto.STRING,
2656 number=11,
2657 )
2658
2659
2660class ReceivedMessage(proto.Message):
2661 r"""A message and its corresponding acknowledgment ID.
2662
2663 Attributes:
2664 ack_id (str):
2665 Optional. This ID can be used to acknowledge
2666 the received message.
2667 message (google.pubsub_v1.types.PubsubMessage):
2668 Optional. The message.
2669 delivery_attempt (int):
2670 Optional. The approximate number of times that Pub/Sub has
2671 attempted to deliver the associated message to a subscriber.
2672
2673 More precisely, this is 1 + (number of NACKs) + (number of
2674 ack_deadline exceeds) for this message.
2675
2676 A NACK is any call to ModifyAckDeadline with a 0 deadline.
2677 An ack_deadline exceeds event is whenever a message is not
2678 acknowledged within ack_deadline. Note that ack_deadline is
2679 initially Subscription.ackDeadlineSeconds, but may get
2680 extended automatically by the client library.
2681
2682 Upon the first delivery of a given message,
2683 ``delivery_attempt`` will have a value of 1. The value is
2684 calculated at best effort and is approximate.
2685
2686 If a DeadLetterPolicy is not set on the subscription, this
2687 will be 0.
2688 """
2689
2690 ack_id: str = proto.Field(
2691 proto.STRING,
2692 number=1,
2693 )
2694 message: "PubsubMessage" = proto.Field(
2695 proto.MESSAGE,
2696 number=2,
2697 message="PubsubMessage",
2698 )
2699 delivery_attempt: int = proto.Field(
2700 proto.INT32,
2701 number=3,
2702 )
2703
2704
2705class GetSubscriptionRequest(proto.Message):
2706 r"""Request for the GetSubscription method.
2707
2708 Attributes:
2709 subscription (str):
2710 Required. The name of the subscription to get. Format is
2711 ``projects/{project}/subscriptions/{sub}``.
2712 """
2713
2714 subscription: str = proto.Field(
2715 proto.STRING,
2716 number=1,
2717 )
2718
2719
2720class UpdateSubscriptionRequest(proto.Message):
2721 r"""Request for the UpdateSubscription method.
2722
2723 Attributes:
2724 subscription (google.pubsub_v1.types.Subscription):
2725 Required. The updated subscription object.
2726 update_mask (google.protobuf.field_mask_pb2.FieldMask):
2727 Required. Indicates which fields in the
2728 provided subscription to update. Must be
2729 specified and non-empty.
2730 """
2731
2732 subscription: "Subscription" = proto.Field(
2733 proto.MESSAGE,
2734 number=1,
2735 message="Subscription",
2736 )
2737 update_mask: field_mask_pb2.FieldMask = proto.Field(
2738 proto.MESSAGE,
2739 number=2,
2740 message=field_mask_pb2.FieldMask,
2741 )
2742
2743
2744class ListSubscriptionsRequest(proto.Message):
2745 r"""Request for the ``ListSubscriptions`` method.
2746
2747 Attributes:
2748 project (str):
2749 Required. The name of the project in which to list
2750 subscriptions. Format is ``projects/{project-id}``.
2751 page_size (int):
2752 Optional. Maximum number of subscriptions to
2753 return.
2754 page_token (str):
2755 Optional. The value returned by the last
2756 ``ListSubscriptionsResponse``; indicates that this is a
2757 continuation of a prior ``ListSubscriptions`` call, and that
2758 the system should return the next page of data.
2759 """
2760
2761 project: str = proto.Field(
2762 proto.STRING,
2763 number=1,
2764 )
2765 page_size: int = proto.Field(
2766 proto.INT32,
2767 number=2,
2768 )
2769 page_token: str = proto.Field(
2770 proto.STRING,
2771 number=3,
2772 )
2773
2774
2775class ListSubscriptionsResponse(proto.Message):
2776 r"""Response for the ``ListSubscriptions`` method.
2777
2778 Attributes:
2779 subscriptions (MutableSequence[google.pubsub_v1.types.Subscription]):
2780 Optional. The subscriptions that match the
2781 request.
2782 next_page_token (str):
2783 Optional. If not empty, indicates that there may be more
2784 subscriptions that match the request; this value should be
2785 passed in a new ``ListSubscriptionsRequest`` to get more
2786 subscriptions.
2787 """
2788
2789 @property
2790 def raw_page(self):
2791 return self
2792
2793 subscriptions: MutableSequence["Subscription"] = proto.RepeatedField(
2794 proto.MESSAGE,
2795 number=1,
2796 message="Subscription",
2797 )
2798 next_page_token: str = proto.Field(
2799 proto.STRING,
2800 number=2,
2801 )
2802
2803
2804class DeleteSubscriptionRequest(proto.Message):
2805 r"""Request for the DeleteSubscription method.
2806
2807 Attributes:
2808 subscription (str):
2809 Required. The subscription to delete. Format is
2810 ``projects/{project}/subscriptions/{sub}``.
2811 """
2812
2813 subscription: str = proto.Field(
2814 proto.STRING,
2815 number=1,
2816 )
2817
2818
2819class ModifyPushConfigRequest(proto.Message):
2820 r"""Request for the ModifyPushConfig method.
2821
2822 Attributes:
2823 subscription (str):
2824 Required. The name of the subscription. Format is
2825 ``projects/{project}/subscriptions/{sub}``.
2826 push_config (google.pubsub_v1.types.PushConfig):
2827 Required. The push configuration for future deliveries.
2828
2829 An empty ``pushConfig`` indicates that the Pub/Sub system
2830 should stop pushing messages from the given subscription and
2831 allow messages to be pulled and acknowledged - effectively
2832 pausing the subscription if ``Pull`` or ``StreamingPull`` is
2833 not called.
2834 """
2835
2836 subscription: str = proto.Field(
2837 proto.STRING,
2838 number=1,
2839 )
2840 push_config: "PushConfig" = proto.Field(
2841 proto.MESSAGE,
2842 number=2,
2843 message="PushConfig",
2844 )
2845
2846
2847class PullRequest(proto.Message):
2848 r"""Request for the ``Pull`` method.
2849
2850 Attributes:
2851 subscription (str):
2852 Required. The subscription from which messages should be
2853 pulled. Format is
2854 ``projects/{project}/subscriptions/{sub}``.
2855 return_immediately (bool):
2856 Optional. If this field set to true, the system will respond
2857 immediately even if it there are no messages available to
2858 return in the ``Pull`` response. Otherwise, the system may
2859 wait (for a bounded amount of time) until at least one
2860 message is available, rather than returning no messages.
2861 Warning: setting this field to ``true`` is discouraged
2862 because it adversely impacts the performance of ``Pull``
2863 operations. We recommend that users do not set this field.
2864 max_messages (int):
2865 Required. The maximum number of messages to
2866 return for this request. Must be a positive
2867 integer. The Pub/Sub system may return fewer
2868 than the number specified.
2869 """
2870
2871 subscription: str = proto.Field(
2872 proto.STRING,
2873 number=1,
2874 )
2875 return_immediately: bool = proto.Field(
2876 proto.BOOL,
2877 number=2,
2878 )
2879 max_messages: int = proto.Field(
2880 proto.INT32,
2881 number=3,
2882 )
2883
2884
2885class PullResponse(proto.Message):
2886 r"""Response for the ``Pull`` method.
2887
2888 Attributes:
2889 received_messages (MutableSequence[google.pubsub_v1.types.ReceivedMessage]):
2890 Optional. Received Pub/Sub messages. The list will be empty
2891 if there are no more messages available in the backlog, or
2892 if no messages could be returned before the request timeout.
2893 For JSON, the response can be entirely empty. The Pub/Sub
2894 system may return fewer than the ``maxMessages`` requested
2895 even if there are more messages available in the backlog.
2896 """
2897
2898 received_messages: MutableSequence["ReceivedMessage"] = proto.RepeatedField(
2899 proto.MESSAGE,
2900 number=1,
2901 message="ReceivedMessage",
2902 )
2903
2904
2905class ModifyAckDeadlineRequest(proto.Message):
2906 r"""Request for the ModifyAckDeadline method.
2907
2908 Attributes:
2909 subscription (str):
2910 Required. The name of the subscription. Format is
2911 ``projects/{project}/subscriptions/{sub}``.
2912 ack_ids (MutableSequence[str]):
2913 Required. List of acknowledgment IDs.
2914 ack_deadline_seconds (int):
2915 Required. The new ack deadline with respect to the time this
2916 request was sent to the Pub/Sub system. For example, if the
2917 value is 10, the new ack deadline will expire 10 seconds
2918 after the ``ModifyAckDeadline`` call was made. Specifying
2919 zero might immediately make the message available for
2920 delivery to another subscriber client. This typically
2921 results in an increase in the rate of message redeliveries
2922 (that is, duplicates). The minimum deadline you can specify
2923 is 0 seconds. The maximum deadline you can specify in a
2924 single request is 600 seconds (10 minutes).
2925 """
2926
2927 subscription: str = proto.Field(
2928 proto.STRING,
2929 number=1,
2930 )
2931 ack_ids: MutableSequence[str] = proto.RepeatedField(
2932 proto.STRING,
2933 number=4,
2934 )
2935 ack_deadline_seconds: int = proto.Field(
2936 proto.INT32,
2937 number=3,
2938 )
2939
2940
2941class AcknowledgeRequest(proto.Message):
2942 r"""Request for the Acknowledge method.
2943
2944 Attributes:
2945 subscription (str):
2946 Required. The subscription whose message is being
2947 acknowledged. Format is
2948 ``projects/{project}/subscriptions/{sub}``.
2949 ack_ids (MutableSequence[str]):
2950 Required. The acknowledgment ID for the messages being
2951 acknowledged that was returned by the Pub/Sub system in the
2952 ``Pull`` response. Must not be empty.
2953 """
2954
2955 subscription: str = proto.Field(
2956 proto.STRING,
2957 number=1,
2958 )
2959 ack_ids: MutableSequence[str] = proto.RepeatedField(
2960 proto.STRING,
2961 number=2,
2962 )
2963
2964
2965class StreamingPullRequest(proto.Message):
2966 r"""Request for the ``StreamingPull`` streaming RPC method. This request
2967 is used to establish the initial stream as well as to stream
2968 acknowledgments and ack deadline modifications from the client to
2969 the server.
2970
2971 Attributes:
2972 subscription (str):
2973 Required. The subscription for which to initialize the new
2974 stream. This must be provided in the first request on the
2975 stream, and must not be set in subsequent requests from
2976 client to server. Format is
2977 ``projects/{project}/subscriptions/{sub}``.
2978 ack_ids (MutableSequence[str]):
2979 Optional. List of acknowledgment IDs for acknowledging
2980 previously received messages (received on this stream or a
2981 different stream). If an ack ID has expired, the
2982 corresponding message may be redelivered later.
2983 Acknowledging a message more than once will not result in an
2984 error. If the acknowledgment ID is malformed, the stream
2985 will be aborted with status ``INVALID_ARGUMENT``.
2986 modify_deadline_seconds (MutableSequence[int]):
2987 Optional. The list of new ack deadlines for the IDs listed
2988 in ``modify_deadline_ack_ids``. The size of this list must
2989 be the same as the size of ``modify_deadline_ack_ids``. If
2990 it differs the stream will be aborted with
2991 ``INVALID_ARGUMENT``. Each element in this list is applied
2992 to the element in the same position in
2993 ``modify_deadline_ack_ids``. The new ack deadline is with
2994 respect to the time this request was sent to the Pub/Sub
2995 system. Must be >= 0. For example, if the value is 10, the
2996 new ack deadline will expire 10 seconds after this request
2997 is received. If the value is 0, the message is immediately
2998 made available for another streaming or non-streaming pull
2999 request. If the value is < 0 (an error), the stream will be
3000 aborted with status ``INVALID_ARGUMENT``.
3001 modify_deadline_ack_ids (MutableSequence[str]):
3002 Optional. List of acknowledgment IDs whose deadline will be
3003 modified based on the corresponding element in
3004 ``modify_deadline_seconds``. This field can be used to
3005 indicate that more time is needed to process a message by
3006 the subscriber, or to make the message available for
3007 redelivery if the processing was interrupted.
3008 stream_ack_deadline_seconds (int):
3009 Required. The ack deadline to use for the
3010 stream. This must be provided in the first
3011 request on the stream, but it can also be
3012 updated on subsequent requests from client to
3013 server. The minimum deadline you can specify is
3014 10 seconds. The maximum deadline you can specify
3015 is 600 seconds (10 minutes).
3016 client_id (str):
3017 Optional. A unique identifier that is used to distinguish
3018 client instances from each other. Only needs to be provided
3019 on the initial request. When a stream disconnects and
3020 reconnects for the same stream, the client_id should be set
3021 to the same value so that state associated with the old
3022 stream can be transferred to the new stream. The same
3023 client_id should not be used for different client instances.
3024 max_outstanding_messages (int):
3025 Optional. Flow control settings for the maximum number of
3026 outstanding messages. When there are
3027 ``max_outstanding_messages`` currently sent to the streaming
3028 pull client that have not yet been acked or nacked, the
3029 server stops sending more messages. The sending of messages
3030 resumes once the number of outstanding messages is less than
3031 this value. If the value is <= 0, there is no limit to the
3032 number of outstanding messages. This property can only be
3033 set on the initial StreamingPullRequest. If it is set on a
3034 subsequent request, the stream will be aborted with status
3035 ``INVALID_ARGUMENT``.
3036 max_outstanding_bytes (int):
3037 Optional. Flow control settings for the maximum number of
3038 outstanding bytes. When there are ``max_outstanding_bytes``
3039 or more worth of messages currently sent to the streaming
3040 pull client that have not yet been acked or nacked, the
3041 server will stop sending more messages. The sending of
3042 messages resumes once the number of outstanding bytes is
3043 less than this value. If the value is <= 0, there is no
3044 limit to the number of outstanding bytes. This property can
3045 only be set on the initial StreamingPullRequest. If it is
3046 set on a subsequent request, the stream will be aborted with
3047 status ``INVALID_ARGUMENT``.
3048 """
3049
3050 subscription: str = proto.Field(
3051 proto.STRING,
3052 number=1,
3053 )
3054 ack_ids: MutableSequence[str] = proto.RepeatedField(
3055 proto.STRING,
3056 number=2,
3057 )
3058 modify_deadline_seconds: MutableSequence[int] = proto.RepeatedField(
3059 proto.INT32,
3060 number=3,
3061 )
3062 modify_deadline_ack_ids: MutableSequence[str] = proto.RepeatedField(
3063 proto.STRING,
3064 number=4,
3065 )
3066 stream_ack_deadline_seconds: int = proto.Field(
3067 proto.INT32,
3068 number=5,
3069 )
3070 client_id: str = proto.Field(
3071 proto.STRING,
3072 number=6,
3073 )
3074 max_outstanding_messages: int = proto.Field(
3075 proto.INT64,
3076 number=7,
3077 )
3078 max_outstanding_bytes: int = proto.Field(
3079 proto.INT64,
3080 number=8,
3081 )
3082
3083
3084class StreamingPullResponse(proto.Message):
3085 r"""Response for the ``StreamingPull`` method. This response is used to
3086 stream messages from the server to the client.
3087
3088 Attributes:
3089 received_messages (MutableSequence[google.pubsub_v1.types.ReceivedMessage]):
3090 Optional. Received Pub/Sub messages. This
3091 will not be empty.
3092 acknowledge_confirmation (google.pubsub_v1.types.StreamingPullResponse.AcknowledgeConfirmation):
3093 Optional. This field will only be set if
3094 ``enable_exactly_once_delivery`` is set to ``true``.
3095 modify_ack_deadline_confirmation (google.pubsub_v1.types.StreamingPullResponse.ModifyAckDeadlineConfirmation):
3096 Optional. This field will only be set if
3097 ``enable_exactly_once_delivery`` is set to ``true``.
3098 subscription_properties (google.pubsub_v1.types.StreamingPullResponse.SubscriptionProperties):
3099 Optional. Properties associated with this
3100 subscription.
3101 """
3102
3103 class AcknowledgeConfirmation(proto.Message):
3104 r"""Acknowledgment IDs sent in one or more previous requests to
3105 acknowledge a previously received message.
3106
3107 Attributes:
3108 ack_ids (MutableSequence[str]):
3109 Optional. Successfully processed
3110 acknowledgment IDs.
3111 invalid_ack_ids (MutableSequence[str]):
3112 Optional. List of acknowledgment IDs that
3113 were malformed or whose acknowledgment deadline
3114 has expired.
3115 unordered_ack_ids (MutableSequence[str]):
3116 Optional. List of acknowledgment IDs that
3117 were out of order.
3118 temporary_failed_ack_ids (MutableSequence[str]):
3119 Optional. List of acknowledgment IDs that
3120 failed processing with temporary issues.
3121 """
3122
3123 ack_ids: MutableSequence[str] = proto.RepeatedField(
3124 proto.STRING,
3125 number=1,
3126 )
3127 invalid_ack_ids: MutableSequence[str] = proto.RepeatedField(
3128 proto.STRING,
3129 number=2,
3130 )
3131 unordered_ack_ids: MutableSequence[str] = proto.RepeatedField(
3132 proto.STRING,
3133 number=3,
3134 )
3135 temporary_failed_ack_ids: MutableSequence[str] = proto.RepeatedField(
3136 proto.STRING,
3137 number=4,
3138 )
3139
3140 class ModifyAckDeadlineConfirmation(proto.Message):
3141 r"""Acknowledgment IDs sent in one or more previous requests to
3142 modify the deadline for a specific message.
3143
3144 Attributes:
3145 ack_ids (MutableSequence[str]):
3146 Optional. Successfully processed
3147 acknowledgment IDs.
3148 invalid_ack_ids (MutableSequence[str]):
3149 Optional. List of acknowledgment IDs that
3150 were malformed or whose acknowledgment deadline
3151 has expired.
3152 temporary_failed_ack_ids (MutableSequence[str]):
3153 Optional. List of acknowledgment IDs that
3154 failed processing with temporary issues.
3155 """
3156
3157 ack_ids: MutableSequence[str] = proto.RepeatedField(
3158 proto.STRING,
3159 number=1,
3160 )
3161 invalid_ack_ids: MutableSequence[str] = proto.RepeatedField(
3162 proto.STRING,
3163 number=2,
3164 )
3165 temporary_failed_ack_ids: MutableSequence[str] = proto.RepeatedField(
3166 proto.STRING,
3167 number=3,
3168 )
3169
3170 class SubscriptionProperties(proto.Message):
3171 r"""Subscription properties sent as part of the response.
3172
3173 Attributes:
3174 exactly_once_delivery_enabled (bool):
3175 Optional. True iff exactly once delivery is
3176 enabled for this subscription.
3177 message_ordering_enabled (bool):
3178 Optional. True iff message ordering is
3179 enabled for this subscription.
3180 """
3181
3182 exactly_once_delivery_enabled: bool = proto.Field(
3183 proto.BOOL,
3184 number=1,
3185 )
3186 message_ordering_enabled: bool = proto.Field(
3187 proto.BOOL,
3188 number=2,
3189 )
3190
3191 received_messages: MutableSequence["ReceivedMessage"] = proto.RepeatedField(
3192 proto.MESSAGE,
3193 number=1,
3194 message="ReceivedMessage",
3195 )
3196 acknowledge_confirmation: AcknowledgeConfirmation = proto.Field(
3197 proto.MESSAGE,
3198 number=5,
3199 message=AcknowledgeConfirmation,
3200 )
3201 modify_ack_deadline_confirmation: ModifyAckDeadlineConfirmation = proto.Field(
3202 proto.MESSAGE,
3203 number=3,
3204 message=ModifyAckDeadlineConfirmation,
3205 )
3206 subscription_properties: SubscriptionProperties = proto.Field(
3207 proto.MESSAGE,
3208 number=4,
3209 message=SubscriptionProperties,
3210 )
3211
3212
3213class CreateSnapshotRequest(proto.Message):
3214 r"""Request for the ``CreateSnapshot`` method.
3215
3216 Attributes:
3217 name (str):
3218 Required. User-provided name for this snapshot. If the name
3219 is not provided in the request, the server will assign a
3220 random name for this snapshot on the same project as the
3221 subscription. Note that for REST API requests, you must
3222 specify a name. See the `resource name
3223 rules <https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names>`__.
3224 Format is ``projects/{project}/snapshots/{snap}``.
3225 subscription (str):
3226 Required. The subscription whose backlog the snapshot
3227 retains. Specifically, the created snapshot is guaranteed to
3228 retain: (a) The existing backlog on the subscription. More
3229 precisely, this is defined as the messages in the
3230 subscription's backlog that are unacknowledged upon the
3231 successful completion of the ``CreateSnapshot`` request; as
3232 well as: (b) Any messages published to the subscription's
3233 topic following the successful completion of the
3234 CreateSnapshot request. Format is
3235 ``projects/{project}/subscriptions/{sub}``.
3236 labels (MutableMapping[str, str]):
3237 Optional. See `Creating and managing
3238 labels <https://cloud.google.com/pubsub/docs/labels>`__.
3239 """
3240
3241 name: str = proto.Field(
3242 proto.STRING,
3243 number=1,
3244 )
3245 subscription: str = proto.Field(
3246 proto.STRING,
3247 number=2,
3248 )
3249 labels: MutableMapping[str, str] = proto.MapField(
3250 proto.STRING,
3251 proto.STRING,
3252 number=3,
3253 )
3254
3255
3256class UpdateSnapshotRequest(proto.Message):
3257 r"""Request for the UpdateSnapshot method.
3258
3259 Attributes:
3260 snapshot (google.pubsub_v1.types.Snapshot):
3261 Required. The updated snapshot object.
3262 update_mask (google.protobuf.field_mask_pb2.FieldMask):
3263 Required. Indicates which fields in the
3264 provided snapshot to update. Must be specified
3265 and non-empty.
3266 """
3267
3268 snapshot: "Snapshot" = proto.Field(
3269 proto.MESSAGE,
3270 number=1,
3271 message="Snapshot",
3272 )
3273 update_mask: field_mask_pb2.FieldMask = proto.Field(
3274 proto.MESSAGE,
3275 number=2,
3276 message=field_mask_pb2.FieldMask,
3277 )
3278
3279
3280class Snapshot(proto.Message):
3281 r"""A snapshot resource. Snapshots are used in
3282 `Seek <https://cloud.google.com/pubsub/docs/replay-overview>`__
3283 operations, which allow you to manage message acknowledgments in
3284 bulk. That is, you can set the acknowledgment state of messages in
3285 an existing subscription to the state captured by a snapshot.
3286
3287 Attributes:
3288 name (str):
3289 Optional. The name of the snapshot.
3290 topic (str):
3291 Optional. The name of the topic from which
3292 this snapshot is retaining messages.
3293 expire_time (google.protobuf.timestamp_pb2.Timestamp):
3294 Optional. The snapshot is guaranteed to exist up until this
3295 time. A newly-created snapshot expires no later than 7 days
3296 from the time of its creation. Its exact lifetime is
3297 determined at creation by the existing backlog in the source
3298 subscription. Specifically, the lifetime of the snapshot is
3299 ``7 days - (age of oldest unacked message in the subscription)``.
3300 For example, consider a subscription whose oldest unacked
3301 message is 3 days old. If a snapshot is created from this
3302 subscription, the snapshot -- which will always capture this
3303 3-day-old backlog as long as the snapshot exists -- will
3304 expire in 4 days. The service will refuse to create a
3305 snapshot that would expire in less than 1 hour after
3306 creation.
3307 labels (MutableMapping[str, str]):
3308 Optional. See [Creating and managing labels]
3309 (https://cloud.google.com/pubsub/docs/labels).
3310 """
3311
3312 name: str = proto.Field(
3313 proto.STRING,
3314 number=1,
3315 )
3316 topic: str = proto.Field(
3317 proto.STRING,
3318 number=2,
3319 )
3320 expire_time: timestamp_pb2.Timestamp = proto.Field(
3321 proto.MESSAGE,
3322 number=3,
3323 message=timestamp_pb2.Timestamp,
3324 )
3325 labels: MutableMapping[str, str] = proto.MapField(
3326 proto.STRING,
3327 proto.STRING,
3328 number=4,
3329 )
3330
3331
3332class GetSnapshotRequest(proto.Message):
3333 r"""Request for the GetSnapshot method.
3334
3335 Attributes:
3336 snapshot (str):
3337 Required. The name of the snapshot to get. Format is
3338 ``projects/{project}/snapshots/{snap}``.
3339 """
3340
3341 snapshot: str = proto.Field(
3342 proto.STRING,
3343 number=1,
3344 )
3345
3346
3347class ListSnapshotsRequest(proto.Message):
3348 r"""Request for the ``ListSnapshots`` method.
3349
3350 Attributes:
3351 project (str):
3352 Required. The name of the project in which to list
3353 snapshots. Format is ``projects/{project-id}``.
3354 page_size (int):
3355 Optional. Maximum number of snapshots to
3356 return.
3357 page_token (str):
3358 Optional. The value returned by the last
3359 ``ListSnapshotsResponse``; indicates that this is a
3360 continuation of a prior ``ListSnapshots`` call, and that the
3361 system should return the next page of data.
3362 """
3363
3364 project: str = proto.Field(
3365 proto.STRING,
3366 number=1,
3367 )
3368 page_size: int = proto.Field(
3369 proto.INT32,
3370 number=2,
3371 )
3372 page_token: str = proto.Field(
3373 proto.STRING,
3374 number=3,
3375 )
3376
3377
3378class ListSnapshotsResponse(proto.Message):
3379 r"""Response for the ``ListSnapshots`` method.
3380
3381 Attributes:
3382 snapshots (MutableSequence[google.pubsub_v1.types.Snapshot]):
3383 Optional. The resulting snapshots.
3384 next_page_token (str):
3385 Optional. If not empty, indicates that there may be more
3386 snapshot that match the request; this value should be passed
3387 in a new ``ListSnapshotsRequest``.
3388 """
3389
3390 @property
3391 def raw_page(self):
3392 return self
3393
3394 snapshots: MutableSequence["Snapshot"] = proto.RepeatedField(
3395 proto.MESSAGE,
3396 number=1,
3397 message="Snapshot",
3398 )
3399 next_page_token: str = proto.Field(
3400 proto.STRING,
3401 number=2,
3402 )
3403
3404
3405class DeleteSnapshotRequest(proto.Message):
3406 r"""Request for the ``DeleteSnapshot`` method.
3407
3408 Attributes:
3409 snapshot (str):
3410 Required. The name of the snapshot to delete. Format is
3411 ``projects/{project}/snapshots/{snap}``.
3412 """
3413
3414 snapshot: str = proto.Field(
3415 proto.STRING,
3416 number=1,
3417 )
3418
3419
3420class SeekRequest(proto.Message):
3421 r"""Request for the ``Seek`` method.
3422
3423 This message has `oneof`_ fields (mutually exclusive fields).
3424 For each oneof, at most one member field can be set at the same time.
3425 Setting any member of the oneof automatically clears all other
3426 members.
3427
3428 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
3429
3430 Attributes:
3431 subscription (str):
3432 Required. The subscription to affect.
3433 time (google.protobuf.timestamp_pb2.Timestamp):
3434 Optional. The time to seek to. Messages retained in the
3435 subscription that were published before this time are marked
3436 as acknowledged, and messages retained in the subscription
3437 that were published after this time are marked as
3438 unacknowledged. Note that this operation affects only those
3439 messages retained in the subscription (configured by the
3440 combination of ``message_retention_duration`` and
3441 ``retain_acked_messages``). For example, if ``time``
3442 corresponds to a point before the message retention window
3443 (or to a point before the system's notion of the
3444 subscription creation time), only retained messages will be
3445 marked as unacknowledged, and already-expunged messages will
3446 not be restored.
3447
3448 This field is a member of `oneof`_ ``target``.
3449 snapshot (str):
3450 Optional. The snapshot to seek to. The snapshot's topic must
3451 be the same as that of the provided subscription. Format is
3452 ``projects/{project}/snapshots/{snap}``.
3453
3454 This field is a member of `oneof`_ ``target``.
3455 """
3456
3457 subscription: str = proto.Field(
3458 proto.STRING,
3459 number=1,
3460 )
3461 time: timestamp_pb2.Timestamp = proto.Field(
3462 proto.MESSAGE,
3463 number=2,
3464 oneof="target",
3465 message=timestamp_pb2.Timestamp,
3466 )
3467 snapshot: str = proto.Field(
3468 proto.STRING,
3469 number=3,
3470 oneof="target",
3471 )
3472
3473
3474class SeekResponse(proto.Message):
3475 r"""Response for the ``Seek`` method (this response is empty)."""
3476
3477
3478__all__ = tuple(sorted(__protobuf__.manifest))