Skip to content

Commit b77cf6d

Browse files
feat: Add export config protos to API (#364)
* feat: Add export config protos to API PiperOrigin-RevId: 468442481 Source-Link: googleapis/googleapis@154b410 Source-Link: googleapis/googleapis-gen@d49c3ee Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDQ5YzNlZTk0MDZmZWY2MDgyMDZkNTRlNDI1OWFmYTNjOWU4YzBjOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 868c439 commit b77cf6d

4 files changed

Lines changed: 123 additions & 0 deletions

File tree

‎google/cloud/pubsublite_v1/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from .types.admin import UpdateTopicRequest
5757
from .types.common import AttributeValues
5858
from .types.common import Cursor
59+
from .types.common import ExportConfig
5960
from .types.common import PubSubMessage
6061
from .types.common import Reservation
6162
from .types.common import SequencedMessage
@@ -123,6 +124,7 @@
123124
"DeleteReservationRequest",
124125
"DeleteSubscriptionRequest",
125126
"DeleteTopicRequest",
127+
"ExportConfig",
126128
"FlowControlRequest",
127129
"GetReservationRequest",
128130
"GetSubscriptionRequest",

‎google/cloud/pubsublite_v1/types/__init__.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from .common import (
4646
AttributeValues,
4747
Cursor,
48+
ExportConfig,
4849
PubSubMessage,
4950
Reservation,
5051
SequencedMessage,
@@ -126,6 +127,7 @@
126127
"UpdateTopicRequest",
127128
"AttributeValues",
128129
"Cursor",
130+
"ExportConfig",
129131
"PubSubMessage",
130132
"Reservation",
131133
"SequencedMessage",

‎google/cloud/pubsublite_v1/types/common.py‎

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from google.protobuf import duration_pb2 # type: ignore
1919
from google.protobuf import timestamp_pb2 # type: ignore
20+
from google.rpc import status_pb2 # type: ignore
2021

2122

2223
__protobuf__ = proto.module(
@@ -29,6 +30,7 @@
2930
"Reservation",
3031
"Topic",
3132
"Subscription",
33+
"ExportConfig",
3234
"TimeTarget",
3335
},
3436
)
@@ -338,6 +340,10 @@ class Subscription(proto.Message):
338340
delivery_config (google.cloud.pubsublite_v1.types.Subscription.DeliveryConfig):
339341
The settings for this subscription's message
340342
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.
341347
"""
342348

343349
class DeliveryConfig(proto.Message):
@@ -377,6 +383,117 @@ class DeliveryRequirement(proto.Enum):
377383
number=3,
378384
message=DeliveryConfig,
379385
)
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+
)
380497

381498

382499
class TimeTarget(proto.Message):

‎tests/unit/gapic/pubsublite_v1/test_admin_service.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@
4949
from google.cloud.pubsublite_v1.types import common
5050
from google.longrunning import operations_pb2
5151
from google.oauth2 import service_account
52+
from google.protobuf import any_pb2 # type: ignore
5253
from google.protobuf import duration_pb2 # type: ignore
5354
from google.protobuf import field_mask_pb2 # type: ignore
5455
from google.protobuf import timestamp_pb2 # type: ignore
56+
from google.rpc import status_pb2 # type: ignore
5557
import google.auth
5658

5759

0 commit comments

Comments
 (0)