1- // Copyright 2021 Google LLC
1+ // Copyright 2022 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -16,9 +16,11 @@ syntax = "proto3";
1616
1717package google.cloud.pubsublite.v1 ;
1818
19+ import "google/api/field_behavior.proto" ;
1920import "google/api/resource.proto" ;
2021import "google/protobuf/duration.proto" ;
2122import "google/protobuf/timestamp.proto" ;
23+ import "google/rpc/status.proto" ;
2224
2325option cc_enable_arenas = true ;
2426option csharp_namespace = "Google.Cloud.PubSubLite.V1" ;
@@ -225,6 +227,79 @@ message Subscription {
225227
226228 // The settings for this subscription's message delivery.
227229 DeliveryConfig delivery_config = 3 ;
230+
231+ // If present, messages are automatically written from the Pub/Sub Lite topic
232+ // associated with this subscription to a destination.
233+ ExportConfig export_config = 4 ;
234+ }
235+
236+ // Configuration for a Pub/Sub Lite subscription that writes messages to a
237+ // destination. User subscriber clients must not connect to this subscription.
238+ message ExportConfig {
239+ // An export state.
240+ enum State {
241+ // Default value. This value is unused.
242+ STATE_UNSPECIFIED = 0 ;
243+
244+ // Messages are being exported.
245+ ACTIVE = 1 ;
246+
247+ // Exporting messages is suspended.
248+ PAUSED = 2 ;
249+ }
250+
251+ // The export status of a partition.
252+ message PartitionStatus {
253+ // The partition number.
254+ int64 partition = 1 ;
255+
256+ // If the export for a partition is healthy and the desired state is
257+ // `ACTIVE`, the status code will be `OK` (zero). If the desired state of
258+ // the export is `PAUSED`, the status code will be `CANCELLED`.
259+ //
260+ // If the export has been suspended due to an error, the status will be
261+ // populated with an error code and details. The service will automatically
262+ // retry after a period of time, and will update the status code to `OK` if
263+ // export subsequently succeeds.
264+ google.rpc.Status status = 2 ;
265+ }
266+
267+ // Configuration for exporting to a Pub/Sub topic.
268+ message PubSubConfig {
269+ // The name of the Pub/Sub topic.
270+ // Structured like: projects/{project_number}/topics/{topic_id}.
271+ // The topic may be changed.
272+ string topic = 1 ;
273+ }
274+
275+ // The desired state of this export.
276+ State desired_state = 1 ;
277+
278+ // Output only. The export statuses of each partition. This field is output only.
279+ repeated PartitionStatus statuses = 4 [(google.api.field_behavior ) = OUTPUT_ONLY ];
280+
281+ // Optional. The name of an optional Pub/Sub Lite topic to publish messages that can not
282+ // be exported to the destination. For example, the message can not be
283+ // published to the Pub/Sub service because it does not satisfy the
284+ // constraints documented at https://cloud.google.com/pubsub/docs/publisher.
285+ //
286+ // Structured like:
287+ // projects/{project_number}/locations/{location}/topics/{topic_id}.
288+ // Must be within the same project and location as the subscription. The topic
289+ // may be changed or removed.
290+ string dead_letter_topic = 5 [
291+ (google.api.field_behavior ) = OPTIONAL ,
292+ (google.api.resource_reference ) = {
293+ type : "pubsublite.googleapis.com/Topic"
294+ }
295+ ];
296+
297+ // The destination to export to. Required.
298+ oneof destination {
299+ // Messages are automatically written from the Pub/Sub Lite topic associated
300+ // with this subscription to a Pub/Sub topic.
301+ PubSubConfig pubsub_config = 3 ;
302+ }
228303}
229304
230305// A target publish or event time. Can be used for seeking to or retrieving the
0 commit comments