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