Skip to content

Commit 154b410

Browse files
Google APIscopybara-github
authored andcommitted
feat: Add export config protos to API
PiperOrigin-RevId: 468442481
1 parent 260cd02 commit 154b410

3 files changed

Lines changed: 79 additions & 1 deletion

File tree

google/cloud/pubsublite/v1/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ proto_library(
3333
"//google/api:client_proto",
3434
"//google/api:field_behavior_proto",
3535
"//google/api:resource_proto",
36+
"//google/rpc:status_proto",
3637
"//google/longrunning:operations_proto",
3738
"@com_google_protobuf//:duration_proto",
3839
"@com_google_protobuf//:empty_proto",
@@ -130,6 +131,7 @@ go_proto_library(
130131
protos = [":pubsublite_proto"],
131132
deps = [
132133
"//google/api:annotations_go_proto",
134+
"//google/rpc:status_go_proto",
133135
"//google/longrunning:longrunning_go_proto",
134136
],
135137
)

google/cloud/pubsublite/v1/common.proto

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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

1717
package google.cloud.pubsublite.v1;
1818

19+
import "google/api/field_behavior.proto";
1920
import "google/api/resource.proto";
2021
import "google/protobuf/duration.proto";
2122
import "google/protobuf/timestamp.proto";
23+
import "google/rpc/status.proto";
2224

2325
option cc_enable_arenas = true;
2426
option 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

google/cloud/pubsublite/v1/pubsublite_v1.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ apis:
1010
- name: google.cloud.pubsublite.v1.PublisherService
1111
- name: google.cloud.pubsublite.v1.SubscriberService
1212
- name: google.cloud.pubsublite.v1.TopicStatsService
13+
- name: google.longrunning.Operations
1314

1415
types:
1516
- name: google.cloud.pubsublite.v1.OperationMetadata

0 commit comments

Comments
 (0)