|
17 | 17 |
|
18 | 18 | from google.protobuf import duration_pb2 # type: ignore |
19 | 19 | from google.protobuf import timestamp_pb2 # type: ignore |
| 20 | +from google.rpc import status_pb2 # type: ignore |
20 | 21 |
|
21 | 22 |
|
22 | 23 | __protobuf__ = proto.module( |
|
29 | 30 | "Reservation", |
30 | 31 | "Topic", |
31 | 32 | "Subscription", |
| 33 | + "ExportConfig", |
32 | 34 | "TimeTarget", |
33 | 35 | }, |
34 | 36 | ) |
@@ -338,6 +340,10 @@ class Subscription(proto.Message): |
338 | 340 | delivery_config (google.cloud.pubsublite_v1.types.Subscription.DeliveryConfig): |
339 | 341 | The settings for this subscription's message |
340 | 342 | delivery. |
| 343 | + export_config (google.cloud.pubsublite_v1.types.ExportConfig): |
| 344 | + If present, messages are automatically |
| 345 | + written from the Pub/Sub Lite topic associated |
| 346 | + with this subscription to a destination. |
341 | 347 | """ |
342 | 348 |
|
343 | 349 | class DeliveryConfig(proto.Message): |
@@ -377,6 +383,117 @@ class DeliveryRequirement(proto.Enum): |
377 | 383 | number=3, |
378 | 384 | message=DeliveryConfig, |
379 | 385 | ) |
| 386 | + export_config = proto.Field( |
| 387 | + proto.MESSAGE, |
| 388 | + number=4, |
| 389 | + message="ExportConfig", |
| 390 | + ) |
| 391 | + |
| 392 | + |
| 393 | +class ExportConfig(proto.Message): |
| 394 | + r"""Configuration for a Pub/Sub Lite subscription that writes |
| 395 | + messages to a destination. User subscriber clients must not |
| 396 | + connect to this subscription. |
| 397 | +
|
| 398 | +
|
| 399 | + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields |
| 400 | +
|
| 401 | + Attributes: |
| 402 | + desired_state (google.cloud.pubsublite_v1.types.ExportConfig.State): |
| 403 | + The desired state of this export. |
| 404 | + statuses (Sequence[google.cloud.pubsublite_v1.types.ExportConfig.PartitionStatus]): |
| 405 | + Output only. The export statuses of each |
| 406 | + partition. This field is output only. |
| 407 | + dead_letter_topic (str): |
| 408 | + Optional. The name of an optional Pub/Sub Lite topic to |
| 409 | + publish messages that can not be exported to the |
| 410 | + destination. For example, the message can not be published |
| 411 | + to the Pub/Sub service because it does not satisfy the |
| 412 | + constraints documented at |
| 413 | + https://cloud.google.com/pubsub/docs/publisher. |
| 414 | +
|
| 415 | + Structured like: |
| 416 | + projects/{project_number}/locations/{location}/topics/{topic_id}. |
| 417 | + Must be within the same project and location as the |
| 418 | + subscription. The topic may be changed or removed. |
| 419 | + pubsub_config (google.cloud.pubsublite_v1.types.ExportConfig.PubSubConfig): |
| 420 | + Messages are automatically written from the |
| 421 | + Pub/Sub Lite topic associated with this |
| 422 | + subscription to a Pub/Sub topic. |
| 423 | +
|
| 424 | + This field is a member of `oneof`_ ``destination``. |
| 425 | + """ |
| 426 | + |
| 427 | + class State(proto.Enum): |
| 428 | + r"""An export state.""" |
| 429 | + STATE_UNSPECIFIED = 0 |
| 430 | + ACTIVE = 1 |
| 431 | + PAUSED = 2 |
| 432 | + |
| 433 | + class PartitionStatus(proto.Message): |
| 434 | + r"""The export status of a partition. |
| 435 | +
|
| 436 | + Attributes: |
| 437 | + partition (int): |
| 438 | + The partition number. |
| 439 | + status (google.rpc.status_pb2.Status): |
| 440 | + If the export for a partition is healthy and the desired |
| 441 | + state is ``ACTIVE``, the status code will be ``OK`` (zero). |
| 442 | + If the desired state of the export is ``PAUSED``, the status |
| 443 | + code will be ``CANCELLED``. |
| 444 | +
|
| 445 | + If the export has been suspended due to an error, the status |
| 446 | + will be populated with an error code and details. The |
| 447 | + service will automatically retry after a period of time, and |
| 448 | + will update the status code to ``OK`` if export subsequently |
| 449 | + succeeds. |
| 450 | + """ |
| 451 | + |
| 452 | + partition = proto.Field( |
| 453 | + proto.INT64, |
| 454 | + number=1, |
| 455 | + ) |
| 456 | + status = proto.Field( |
| 457 | + proto.MESSAGE, |
| 458 | + number=2, |
| 459 | + message=status_pb2.Status, |
| 460 | + ) |
| 461 | + |
| 462 | + class PubSubConfig(proto.Message): |
| 463 | + r"""Configuration for exporting to a Pub/Sub topic. |
| 464 | +
|
| 465 | + Attributes: |
| 466 | + topic (str): |
| 467 | + The name of the Pub/Sub topic. Structured like: |
| 468 | + projects/{project_number}/topics/{topic_id}. The topic may |
| 469 | + be changed. |
| 470 | + """ |
| 471 | + |
| 472 | + topic = proto.Field( |
| 473 | + proto.STRING, |
| 474 | + number=1, |
| 475 | + ) |
| 476 | + |
| 477 | + desired_state = proto.Field( |
| 478 | + proto.ENUM, |
| 479 | + number=1, |
| 480 | + enum=State, |
| 481 | + ) |
| 482 | + statuses = proto.RepeatedField( |
| 483 | + proto.MESSAGE, |
| 484 | + number=4, |
| 485 | + message=PartitionStatus, |
| 486 | + ) |
| 487 | + dead_letter_topic = proto.Field( |
| 488 | + proto.STRING, |
| 489 | + number=5, |
| 490 | + ) |
| 491 | + pubsub_config = proto.Field( |
| 492 | + proto.MESSAGE, |
| 493 | + number=3, |
| 494 | + oneof="destination", |
| 495 | + message=PubSubConfig, |
| 496 | + ) |
380 | 497 |
|
381 | 498 |
|
382 | 499 | class TimeTarget(proto.Message): |
|
0 commit comments