xref: /aosp_15_r20/external/googleapis/google/cloud/pubsublite/v1/admin.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.pubsublite.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/cloud/pubsublite/v1/common.proto";
24import "google/longrunning/operations.proto";
25import "google/protobuf/empty.proto";
26import "google/protobuf/field_mask.proto";
27import "google/protobuf/timestamp.proto";
28
29option csharp_namespace = "Google.Cloud.PubSubLite.V1";
30option go_package = "cloud.google.com/go/pubsublite/apiv1/pubsublitepb;pubsublitepb";
31option java_multiple_files = true;
32option java_outer_classname = "AdminProto";
33option java_package = "com.google.cloud.pubsublite.proto";
34option php_namespace = "Google\\Cloud\\PubSubLite\\V1";
35option ruby_package = "Google::Cloud::PubSubLite::V1";
36
37// The service that a client application uses to manage topics and
38// subscriptions, such creating, listing, and deleting topics and subscriptions.
39service AdminService {
40  option (google.api.default_host) = "pubsublite.googleapis.com";
41  option (google.api.oauth_scopes) =
42      "https://www.googleapis.com/auth/cloud-platform";
43
44  // Creates a new topic.
45  rpc CreateTopic(CreateTopicRequest) returns (Topic) {
46    option (google.api.http) = {
47      post: "/v1/admin/{parent=projects/*/locations/*}/topics"
48      body: "topic"
49    };
50    option (google.api.method_signature) = "parent,topic,topic_id";
51  }
52
53  // Returns the topic configuration.
54  rpc GetTopic(GetTopicRequest) returns (Topic) {
55    option (google.api.http) = {
56      get: "/v1/admin/{name=projects/*/locations/*/topics/*}"
57    };
58    option (google.api.method_signature) = "name";
59  }
60
61  // Returns the partition information for the requested topic.
62  rpc GetTopicPartitions(GetTopicPartitionsRequest) returns (TopicPartitions) {
63    option (google.api.http) = {
64      get: "/v1/admin/{name=projects/*/locations/*/topics/*}/partitions"
65    };
66    option (google.api.method_signature) = "name";
67  }
68
69  // Returns the list of topics for the given project.
70  rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) {
71    option (google.api.http) = {
72      get: "/v1/admin/{parent=projects/*/locations/*}/topics"
73    };
74    option (google.api.method_signature) = "parent";
75  }
76
77  // Updates properties of the specified topic.
78  rpc UpdateTopic(UpdateTopicRequest) returns (Topic) {
79    option (google.api.http) = {
80      patch: "/v1/admin/{topic.name=projects/*/locations/*/topics/*}"
81      body: "topic"
82    };
83    option (google.api.method_signature) = "topic,update_mask";
84  }
85
86  // Deletes the specified topic.
87  rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) {
88    option (google.api.http) = {
89      delete: "/v1/admin/{name=projects/*/locations/*/topics/*}"
90    };
91    option (google.api.method_signature) = "name";
92  }
93
94  // Lists the subscriptions attached to the specified topic.
95  rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest)
96      returns (ListTopicSubscriptionsResponse) {
97    option (google.api.http) = {
98      get: "/v1/admin/{name=projects/*/locations/*/topics/*}/subscriptions"
99    };
100    option (google.api.method_signature) = "name";
101  }
102
103  // Creates a new subscription.
104  rpc CreateSubscription(CreateSubscriptionRequest) returns (Subscription) {
105    option (google.api.http) = {
106      post: "/v1/admin/{parent=projects/*/locations/*}/subscriptions"
107      body: "subscription"
108    };
109    option (google.api.method_signature) =
110        "parent,subscription,subscription_id";
111  }
112
113  // Returns the subscription configuration.
114  rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) {
115    option (google.api.http) = {
116      get: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}"
117    };
118    option (google.api.method_signature) = "name";
119  }
120
121  // Returns the list of subscriptions for the given project.
122  rpc ListSubscriptions(ListSubscriptionsRequest)
123      returns (ListSubscriptionsResponse) {
124    option (google.api.http) = {
125      get: "/v1/admin/{parent=projects/*/locations/*}/subscriptions"
126    };
127    option (google.api.method_signature) = "parent";
128  }
129
130  // Updates properties of the specified subscription.
131  rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) {
132    option (google.api.http) = {
133      patch: "/v1/admin/{subscription.name=projects/*/locations/*/subscriptions/*}"
134      body: "subscription"
135    };
136    option (google.api.method_signature) = "subscription,update_mask";
137  }
138
139  // Deletes the specified subscription.
140  rpc DeleteSubscription(DeleteSubscriptionRequest)
141      returns (google.protobuf.Empty) {
142    option (google.api.http) = {
143      delete: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}"
144    };
145    option (google.api.method_signature) = "name";
146  }
147
148  // Performs an out-of-band seek for a subscription to a specified target,
149  // which may be timestamps or named positions within the message backlog.
150  // Seek translates these targets to cursors for each partition and
151  // orchestrates subscribers to start consuming messages from these seek
152  // cursors.
153  //
154  // If an operation is returned, the seek has been registered and subscribers
155  // will eventually receive messages from the seek cursors (i.e. eventual
156  // consistency), as long as they are using a minimum supported client library
157  // version and not a system that tracks cursors independently of Pub/Sub Lite
158  // (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for
159  // unsupported clients.
160  //
161  // If clients would like to know when subscribers react to the seek (or not),
162  // they can poll the operation. The seek operation will succeed and complete
163  // once subscribers are ready to receive messages from the seek cursors for
164  // all partitions of the topic. This means that the seek operation will not
165  // complete until all subscribers come online.
166  //
167  // If the previous seek operation has not yet completed, it will be aborted
168  // and the new invocation of seek will supersede it.
169  rpc SeekSubscription(SeekSubscriptionRequest)
170      returns (google.longrunning.Operation) {
171    option (google.api.http) = {
172      post: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}:seek"
173      body: "*"
174    };
175    option (google.longrunning.operation_info) = {
176      response_type: "SeekSubscriptionResponse"
177      metadata_type: "OperationMetadata"
178    };
179  }
180
181  // Creates a new reservation.
182  rpc CreateReservation(CreateReservationRequest) returns (Reservation) {
183    option (google.api.http) = {
184      post: "/v1/admin/{parent=projects/*/locations/*}/reservations"
185      body: "reservation"
186    };
187    option (google.api.method_signature) = "parent,reservation,reservation_id";
188  }
189
190  // Returns the reservation configuration.
191  rpc GetReservation(GetReservationRequest) returns (Reservation) {
192    option (google.api.http) = {
193      get: "/v1/admin/{name=projects/*/locations/*/reservations/*}"
194    };
195    option (google.api.method_signature) = "name";
196  }
197
198  // Returns the list of reservations for the given project.
199  rpc ListReservations(ListReservationsRequest)
200      returns (ListReservationsResponse) {
201    option (google.api.http) = {
202      get: "/v1/admin/{parent=projects/*/locations/*}/reservations"
203    };
204    option (google.api.method_signature) = "parent";
205  }
206
207  // Updates properties of the specified reservation.
208  rpc UpdateReservation(UpdateReservationRequest) returns (Reservation) {
209    option (google.api.http) = {
210      patch: "/v1/admin/{reservation.name=projects/*/locations/*/reservations/*}"
211      body: "reservation"
212    };
213    option (google.api.method_signature) = "reservation,update_mask";
214  }
215
216  // Deletes the specified reservation.
217  rpc DeleteReservation(DeleteReservationRequest)
218      returns (google.protobuf.Empty) {
219    option (google.api.http) = {
220      delete: "/v1/admin/{name=projects/*/locations/*/reservations/*}"
221    };
222    option (google.api.method_signature) = "name";
223  }
224
225  // Lists the topics attached to the specified reservation.
226  rpc ListReservationTopics(ListReservationTopicsRequest)
227      returns (ListReservationTopicsResponse) {
228    option (google.api.http) = {
229      get: "/v1/admin/{name=projects/*/locations/*/reservations/*}/topics"
230    };
231    option (google.api.method_signature) = "name";
232  }
233}
234
235// Request for CreateTopic.
236message CreateTopicRequest {
237  // Required. The parent location in which to create the topic.
238  // Structured like `projects/{project_number}/locations/{location}`.
239  string parent = 1 [
240    (google.api.field_behavior) = REQUIRED,
241    (google.api.resource_reference) = {
242      type: "locations.googleapis.com/Location"
243    }
244  ];
245
246  // Required. Configuration of the topic to create. Its `name` field is
247  // ignored.
248  Topic topic = 2 [(google.api.field_behavior) = REQUIRED];
249
250  // Required. The ID to use for the topic, which will become the final
251  // component of the topic's name.
252  //
253  // This value is structured like: `my-topic-name`.
254  string topic_id = 3 [(google.api.field_behavior) = REQUIRED];
255}
256
257// Request for GetTopic.
258message GetTopicRequest {
259  // Required. The name of the topic whose configuration to return.
260  string name = 1 [
261    (google.api.field_behavior) = REQUIRED,
262    (google.api.resource_reference) = {
263      type: "pubsublite.googleapis.com/Topic"
264    }
265  ];
266}
267
268// Request for GetTopicPartitions.
269message GetTopicPartitionsRequest {
270  // Required. The topic whose partition information to return.
271  string name = 1 [
272    (google.api.field_behavior) = REQUIRED,
273    (google.api.resource_reference) = {
274      type: "pubsublite.googleapis.com/Topic"
275    }
276  ];
277}
278
279// Response for GetTopicPartitions.
280message TopicPartitions {
281  // The number of partitions in the topic.
282  int64 partition_count = 1;
283}
284
285// Request for ListTopics.
286message ListTopicsRequest {
287  // Required. The parent whose topics are to be listed.
288  // Structured like `projects/{project_number}/locations/{location}`.
289  string parent = 1 [
290    (google.api.field_behavior) = REQUIRED,
291    (google.api.resource_reference) = {
292      type: "locations.googleapis.com/Location"
293    }
294  ];
295
296  // The maximum number of topics to return. The service may return fewer than
297  // this value.
298  // If unset or zero, all topics for the parent will be returned.
299  int32 page_size = 2;
300
301  // A page token, received from a previous `ListTopics` call.
302  // Provide this to retrieve the subsequent page.
303  //
304  // When paginating, all other parameters provided to `ListTopics` must match
305  // the call that provided the page token.
306  string page_token = 3;
307}
308
309// Response for ListTopics.
310message ListTopicsResponse {
311  // The list of topic in the requested parent. The order of the topics is
312  // unspecified.
313  repeated Topic topics = 1;
314
315  // A token that can be sent as `page_token` to retrieve the next page of
316  // results. If this field is omitted, there are no more results.
317  string next_page_token = 2;
318}
319
320// Request for UpdateTopic.
321message UpdateTopicRequest {
322  // Required. The topic to update. Its `name` field must be populated.
323  Topic topic = 1 [(google.api.field_behavior) = REQUIRED];
324
325  // Required. A mask specifying the topic fields to change.
326  google.protobuf.FieldMask update_mask = 2
327      [(google.api.field_behavior) = REQUIRED];
328}
329
330// Request for DeleteTopic.
331message DeleteTopicRequest {
332  // Required. The name of the topic to delete.
333  string name = 1 [
334    (google.api.field_behavior) = REQUIRED,
335    (google.api.resource_reference) = {
336      type: "pubsublite.googleapis.com/Topic"
337    }
338  ];
339}
340
341// Request for ListTopicSubscriptions.
342message ListTopicSubscriptionsRequest {
343  // Required. The name of the topic whose subscriptions to list.
344  string name = 1 [
345    (google.api.field_behavior) = REQUIRED,
346    (google.api.resource_reference) = {
347      type: "pubsublite.googleapis.com/Topic"
348    }
349  ];
350
351  // The maximum number of subscriptions to return. The service may return fewer
352  // than this value.
353  // If unset or zero, all subscriptions for the given topic will be returned.
354  int32 page_size = 2;
355
356  // A page token, received from a previous `ListTopicSubscriptions` call.
357  // Provide this to retrieve the subsequent page.
358  //
359  // When paginating, all other parameters provided to `ListTopicSubscriptions`
360  // must match the call that provided the page token.
361  string page_token = 3;
362}
363
364// Response for ListTopicSubscriptions.
365message ListTopicSubscriptionsResponse {
366  // The names of subscriptions attached to the topic. The order of the
367  // subscriptions is unspecified.
368  repeated string subscriptions = 1;
369
370  // A token that can be sent as `page_token` to retrieve the next page of
371  // results. If this field is omitted, there are no more results.
372  string next_page_token = 2;
373}
374
375// Request for CreateSubscription.
376message CreateSubscriptionRequest {
377  // Required. The parent location in which to create the subscription.
378  // Structured like `projects/{project_number}/locations/{location}`.
379  string parent = 1 [
380    (google.api.field_behavior) = REQUIRED,
381    (google.api.resource_reference) = {
382      type: "locations.googleapis.com/Location"
383    }
384  ];
385
386  // Required. Configuration of the subscription to create. Its `name` field is
387  // ignored.
388  Subscription subscription = 2 [(google.api.field_behavior) = REQUIRED];
389
390  // Required. The ID to use for the subscription, which will become the final
391  // component of the subscription's name.
392  //
393  // This value is structured like: `my-sub-name`.
394  string subscription_id = 3 [(google.api.field_behavior) = REQUIRED];
395
396  // If true, the newly created subscription will only receive messages
397  // published after the subscription was created. Otherwise, the entire
398  // message backlog will be received on the subscription. Defaults to false.
399  bool skip_backlog = 4;
400}
401
402// Request for GetSubscription.
403message GetSubscriptionRequest {
404  // Required. The name of the subscription whose configuration to return.
405  string name = 1 [
406    (google.api.field_behavior) = REQUIRED,
407    (google.api.resource_reference) = {
408      type: "pubsublite.googleapis.com/Subscription"
409    }
410  ];
411}
412
413// Request for ListSubscriptions.
414message ListSubscriptionsRequest {
415  // Required. The parent whose subscriptions are to be listed.
416  // Structured like `projects/{project_number}/locations/{location}`.
417  string parent = 1 [
418    (google.api.field_behavior) = REQUIRED,
419    (google.api.resource_reference) = {
420      type: "locations.googleapis.com/Location"
421    }
422  ];
423
424  // The maximum number of subscriptions to return. The service may return fewer
425  // than this value.
426  // If unset or zero, all subscriptions for the parent will be returned.
427  int32 page_size = 2;
428
429  // A page token, received from a previous `ListSubscriptions` call.
430  // Provide this to retrieve the subsequent page.
431  //
432  // When paginating, all other parameters provided to `ListSubscriptions` must
433  // match the call that provided the page token.
434  string page_token = 3;
435}
436
437// Response for ListSubscriptions.
438message ListSubscriptionsResponse {
439  // The list of subscriptions in the requested parent. The order of the
440  // subscriptions is unspecified.
441  repeated Subscription subscriptions = 1;
442
443  // A token that can be sent as `page_token` to retrieve the next page of
444  // results. If this field is omitted, there are no more results.
445  string next_page_token = 2;
446}
447
448// Request for UpdateSubscription.
449message UpdateSubscriptionRequest {
450  // Required. The subscription to update. Its `name` field must be populated.
451  // Topic field must not be populated.
452  Subscription subscription = 1 [(google.api.field_behavior) = REQUIRED];
453
454  // Required. A mask specifying the subscription fields to change.
455  google.protobuf.FieldMask update_mask = 2
456      [(google.api.field_behavior) = REQUIRED];
457}
458
459// Request for DeleteSubscription.
460message DeleteSubscriptionRequest {
461  // Required. The name of the subscription to delete.
462  string name = 1 [
463    (google.api.field_behavior) = REQUIRED,
464    (google.api.resource_reference) = {
465      type: "pubsublite.googleapis.com/Subscription"
466    }
467  ];
468}
469
470// Request for SeekSubscription.
471message SeekSubscriptionRequest {
472  // A named position with respect to the message backlog.
473  enum NamedTarget {
474    // Unspecified named target. Do not use.
475    NAMED_TARGET_UNSPECIFIED = 0;
476
477    // Seek to the oldest retained message.
478    TAIL = 1;
479
480    // Seek past all recently published messages, skipping the entire message
481    // backlog.
482    HEAD = 2;
483  }
484
485  // Required. The name of the subscription to seek.
486  string name = 1 [
487    (google.api.field_behavior) = REQUIRED,
488    (google.api.resource_reference) = {
489      type: "pubsublite.googleapis.com/Subscription"
490    }
491  ];
492
493  // The target to seek to. Must be set.
494  oneof target {
495    // Seek to a named position with respect to the message backlog.
496    NamedTarget named_target = 2;
497
498    // Seek to the first message whose publish or event time is greater than or
499    // equal to the specified query time. If no such message can be located,
500    // will seek to the end of the message backlog.
501    TimeTarget time_target = 3;
502  }
503}
504
505// Response for SeekSubscription long running operation.
506message SeekSubscriptionResponse {}
507
508// Metadata for long running operations.
509message OperationMetadata {
510  // The time the operation was created.
511  google.protobuf.Timestamp create_time = 1;
512
513  // The time the operation finished running. Not set if the operation has not
514  // completed.
515  google.protobuf.Timestamp end_time = 2;
516
517  // Resource path for the target of the operation. For example, targets of
518  // seeks are subscription resources, structured like:
519  // projects/{project_number}/locations/{location}/subscriptions/{subscription_id}
520  string target = 3;
521
522  // Name of the verb executed by the operation.
523  string verb = 4;
524}
525
526// Request for CreateReservation.
527message CreateReservationRequest {
528  // Required. The parent location in which to create the reservation.
529  // Structured like `projects/{project_number}/locations/{location}`.
530  string parent = 1 [
531    (google.api.field_behavior) = REQUIRED,
532    (google.api.resource_reference) = {
533      type: "locations.googleapis.com/Location"
534    }
535  ];
536
537  // Required. Configuration of the reservation to create. Its `name` field is
538  // ignored.
539  Reservation reservation = 2 [(google.api.field_behavior) = REQUIRED];
540
541  // Required. The ID to use for the reservation, which will become the final
542  // component of the reservation's name.
543  //
544  // This value is structured like: `my-reservation-name`.
545  string reservation_id = 3 [(google.api.field_behavior) = REQUIRED];
546}
547
548// Request for GetReservation.
549message GetReservationRequest {
550  // Required. The name of the reservation whose configuration to return.
551  // Structured like:
552  // projects/{project_number}/locations/{location}/reservations/{reservation_id}
553  string name = 1 [
554    (google.api.field_behavior) = REQUIRED,
555    (google.api.resource_reference) = {
556      type: "pubsublite.googleapis.com/Reservation"
557    }
558  ];
559}
560
561// Request for ListReservations.
562message ListReservationsRequest {
563  // Required. The parent whose reservations are to be listed.
564  // Structured like `projects/{project_number}/locations/{location}`.
565  string parent = 1 [
566    (google.api.field_behavior) = REQUIRED,
567    (google.api.resource_reference) = {
568      type: "locations.googleapis.com/Location"
569    }
570  ];
571
572  // The maximum number of reservations to return. The service may return fewer
573  // than this value. If unset or zero, all reservations for the parent will be
574  // returned.
575  int32 page_size = 2;
576
577  // A page token, received from a previous `ListReservations` call.
578  // Provide this to retrieve the subsequent page.
579  //
580  // When paginating, all other parameters provided to `ListReservations` must
581  // match the call that provided the page token.
582  string page_token = 3;
583}
584
585// Response for ListReservations.
586message ListReservationsResponse {
587  // The list of reservation in the requested parent. The order of the
588  // reservations is unspecified.
589  repeated Reservation reservations = 1;
590
591  // A token that can be sent as `page_token` to retrieve the next page of
592  // results. If this field is omitted, there are no more results.
593  string next_page_token = 2;
594}
595
596// Request for UpdateReservation.
597message UpdateReservationRequest {
598  // Required. The reservation to update. Its `name` field must be populated.
599  Reservation reservation = 1 [(google.api.field_behavior) = REQUIRED];
600
601  // Required. A mask specifying the reservation fields to change.
602  google.protobuf.FieldMask update_mask = 2
603      [(google.api.field_behavior) = REQUIRED];
604}
605
606// Request for DeleteReservation.
607message DeleteReservationRequest {
608  // Required. The name of the reservation to delete.
609  // Structured like:
610  // projects/{project_number}/locations/{location}/reservations/{reservation_id}
611  string name = 1 [
612    (google.api.field_behavior) = REQUIRED,
613    (google.api.resource_reference) = {
614      type: "pubsublite.googleapis.com/Reservation"
615    }
616  ];
617}
618
619// Request for ListReservationTopics.
620message ListReservationTopicsRequest {
621  // Required. The name of the reservation whose topics to list.
622  // Structured like:
623  // projects/{project_number}/locations/{location}/reservations/{reservation_id}
624  string name = 1 [
625    (google.api.field_behavior) = REQUIRED,
626    (google.api.resource_reference) = {
627      type: "pubsublite.googleapis.com/Reservation"
628    }
629  ];
630
631  // The maximum number of topics to return. The service may return fewer
632  // than this value.
633  // If unset or zero, all topics for the given reservation will be returned.
634  int32 page_size = 2;
635
636  // A page token, received from a previous `ListReservationTopics` call.
637  // Provide this to retrieve the subsequent page.
638  //
639  // When paginating, all other parameters provided to `ListReservationTopics`
640  // must match the call that provided the page token.
641  string page_token = 3;
642}
643
644// Response for ListReservationTopics.
645message ListReservationTopicsResponse {
646  // The names of topics attached to the reservation. The order of the
647  // topics is unspecified.
648  repeated string topics = 1;
649
650  // A token that can be sent as `page_token` to retrieve the next page of
651  // results. If this field is omitted, there are no more results.
652  string next_page_token = 2;
653}
654