// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package google.cloud.pubsublite.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/pubsublite/v1/common.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; option csharp_namespace = "Google.Cloud.PubSubLite.V1"; option go_package = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1;pubsublite"; option java_multiple_files = true; option java_outer_classname = "AdminProto"; option java_package = "com.google.cloud.pubsublite.proto"; option php_namespace = "Google\\Cloud\\PubSubLite\\V1"; option ruby_package = "Google::Cloud::PubSubLite::V1"; // The service that a client application uses to manage topics and // subscriptions, such creating, listing, and deleting topics and subscriptions. service AdminService { option (google.api.default_host) = "pubsublite.googleapis.com"; option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; // Creates a new topic. rpc CreateTopic(CreateTopicRequest) returns (Topic) { option (google.api.http) = { post: "/v1/admin/{parent=projects/*/locations/*}/topics" body: "topic" }; option (google.api.method_signature) = "parent,topic,topic_id"; } // Returns the topic configuration. rpc GetTopic(GetTopicRequest) returns (Topic) { option (google.api.http) = { get: "/v1/admin/{name=projects/*/locations/*/topics/*}" }; option (google.api.method_signature) = "name"; } // Returns the partition information for the requested topic. rpc GetTopicPartitions(GetTopicPartitionsRequest) returns (TopicPartitions) { option (google.api.http) = { get: "/v1/admin/{name=projects/*/locations/*/topics/*}/partitions" }; option (google.api.method_signature) = "name"; } // Returns the list of topics for the given project. rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) { option (google.api.http) = { get: "/v1/admin/{parent=projects/*/locations/*}/topics" }; option (google.api.method_signature) = "parent"; } // Updates properties of the specified topic. rpc UpdateTopic(UpdateTopicRequest) returns (Topic) { option (google.api.http) = { patch: "/v1/admin/{topic.name=projects/*/locations/*/topics/*}" body: "topic" }; option (google.api.method_signature) = "topic,update_mask"; } // Deletes the specified topic. rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/admin/{name=projects/*/locations/*/topics/*}" }; option (google.api.method_signature) = "name"; } // Lists the subscriptions attached to the specified topic. rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse) { option (google.api.http) = { get: "/v1/admin/{name=projects/*/locations/*/topics/*}/subscriptions" }; option (google.api.method_signature) = "name"; } // Creates a new subscription. rpc CreateSubscription(CreateSubscriptionRequest) returns (Subscription) { option (google.api.http) = { post: "/v1/admin/{parent=projects/*/locations/*}/subscriptions" body: "subscription" }; option (google.api.method_signature) = "parent,subscription,subscription_id"; } // Returns the subscription configuration. rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) { option (google.api.http) = { get: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}" }; option (google.api.method_signature) = "name"; } // Returns the list of subscriptions for the given project. rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse) { option (google.api.http) = { get: "/v1/admin/{parent=projects/*/locations/*}/subscriptions" }; option (google.api.method_signature) = "parent"; } // Updates properties of the specified subscription. rpc UpdateSubscription(UpdateSubscriptionRequest) returns (Subscription) { option (google.api.http) = { patch: "/v1/admin/{subscription.name=projects/*/locations/*/subscriptions/*}" body: "subscription" }; option (google.api.method_signature) = "subscription,update_mask"; } // Deletes the specified subscription. rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty) { option (google.api.http) = { delete: "/v1/admin/{name=projects/*/locations/*/subscriptions/*}" }; option (google.api.method_signature) = "name"; } } // Request for CreateTopic. message CreateTopicRequest { // Required. The parent location in which to create the topic. // Structured like `projects/{project_number}/locations/{location}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "locations.googleapis.com/Location" } ]; // Required. Configuration of the topic to create. Its `name` field is ignored. Topic topic = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The ID to use for the topic, which will become the final component of // the topic's name. // // This value is structured like: `my-topic-name`. string topic_id = 3 [(google.api.field_behavior) = REQUIRED]; } // Request for GetTopic. message GetTopicRequest { // Required. The name of the topic whose configuration to return. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Topic" } ]; } // Request for GetTopicPartitions. message GetTopicPartitionsRequest { // Required. The topic whose partition information to return. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Topic" } ]; } // Response for GetTopicPartitions. message TopicPartitions { // The number of partitions in the topic. int64 partition_count = 1; } // Request for ListTopics. message ListTopicsRequest { // Required. The parent whose topics are to be listed. // Structured like `projects/{project_number}/locations/{location}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "locations.googleapis.com/Location" } ]; // The maximum number of topics to return. The service may return fewer than // this value. // If unset or zero, all topics for the parent will be returned. int32 page_size = 2; // A page token, received from a previous `ListTopics` call. // Provide this to retrieve the subsequent page. // // When paginating, all other parameters provided to `ListTopics` must match // the call that provided the page token. string page_token = 3; } // Response for ListTopics. message ListTopicsResponse { // The list of topic in the requested parent. The order of the topics is // unspecified. repeated Topic topics = 1; // A token that can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no more results. string next_page_token = 2; } // Request for UpdateTopic. message UpdateTopicRequest { // Required. The topic to update. Its `name` field must be populated. Topic topic = 1 [(google.api.field_behavior) = REQUIRED]; // Required. A mask specifying the topic fields to change. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } // Request for DeleteTopic. message DeleteTopicRequest { // Required. The name of the topic to delete. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Topic" } ]; } // Request for ListTopicSubscriptions. message ListTopicSubscriptionsRequest { // Required. The name of the topic whose subscriptions to list. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Topic" } ]; // The maximum number of subscriptions to return. The service may return fewer // than this value. // If unset or zero, all subscriptions for the given topic will be returned. int32 page_size = 2; // A page token, received from a previous `ListTopicSubscriptions` call. // Provide this to retrieve the subsequent page. // // When paginating, all other parameters provided to `ListTopicSubscriptions` // must match the call that provided the page token. string page_token = 3; } // Response for ListTopicSubscriptions. message ListTopicSubscriptionsResponse { // The names of subscriptions attached to the topic. The order of the // subscriptions is unspecified. repeated string subscriptions = 1; // A token that can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no more results. string next_page_token = 2; } // Request for CreateSubscription. message CreateSubscriptionRequest { // Required. The parent location in which to create the subscription. // Structured like `projects/{project_number}/locations/{location}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "locations.googleapis.com/Location" } ]; // Required. Configuration of the subscription to create. Its `name` field is ignored. Subscription subscription = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The ID to use for the subscription, which will become the final component // of the subscription's name. // // This value is structured like: `my-sub-name`. string subscription_id = 3 [(google.api.field_behavior) = REQUIRED]; // If true, the newly created subscription will only receive messages // published after the subscription was created. Otherwise, the entire // message backlog will be received on the subscription. Defaults to false. bool skip_backlog = 4; } // Request for GetSubscription. message GetSubscriptionRequest { // Required. The name of the subscription whose configuration to return. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Subscription" } ]; } // Request for ListSubscriptions. message ListSubscriptionsRequest { // Required. The parent whose subscriptions are to be listed. // Structured like `projects/{project_number}/locations/{location}`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "locations.googleapis.com/Location" } ]; // The maximum number of subscriptions to return. The service may return fewer // than this value. // If unset or zero, all subscriptions for the parent will be returned. int32 page_size = 2; // A page token, received from a previous `ListSubscriptions` call. // Provide this to retrieve the subsequent page. // // When paginating, all other parameters provided to `ListSubscriptions` must // match the call that provided the page token. string page_token = 3; } // Response for ListSubscriptions. message ListSubscriptionsResponse { // The list of subscriptions in the requested parent. The order of the // subscriptions is unspecified. repeated Subscription subscriptions = 1; // A token that can be sent as `page_token` to retrieve the next page of // results. If this field is omitted, there are no more results. string next_page_token = 2; } // Request for UpdateSubscription. message UpdateSubscriptionRequest { // Required. The subscription to update. Its `name` field must be populated. // Topic field must not be populated. Subscription subscription = 1 [(google.api.field_behavior) = REQUIRED]; // Required. A mask specifying the subscription fields to change. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; } // Request for DeleteSubscription. message DeleteSubscriptionRequest { // Required. The name of the subscription to delete. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "pubsublite.googleapis.com/Subscription" } ]; }