From 4e85ac1f8f45d83d71a58001ea5c59e80e62db9f Mon Sep 17 00:00:00 2001 From: wora Date: Mon, 27 Jul 2015 10:14:56 -0700 Subject: [PATCH] Update Google Cloud Pub/Sub API v1 with latest documentation. --- google/pubsub/v1/pubsub.proto | 72 +++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/google/pubsub/v1/pubsub.proto b/google/pubsub/v1/pubsub.proto index e464e759f..d3a28a20b 100644 --- a/google/pubsub/v1/pubsub.proto +++ b/google/pubsub/v1/pubsub.proto @@ -16,6 +16,7 @@ syntax = "proto3"; package google.pubsub.v1; +import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; option java_multiple_files = true; @@ -32,26 +33,36 @@ service Subscriber { // // If the name is not provided in the request, the server will assign a random // name for this subscription on the same project as the topic. - rpc CreateSubscription(Subscription) returns (Subscription); + rpc CreateSubscription(Subscription) returns (Subscription) { + option (google.api.http) = { put: "/v1/{name=projects/*/subscriptions/*}" body: "*" }; + } // Gets the configuration details of a subscription. - rpc GetSubscription(GetSubscriptionRequest) returns (Subscription); + rpc GetSubscription(GetSubscriptionRequest) returns (Subscription) { + option (google.api.http) = { get: "/v1/{subscription=projects/*/subscriptions/*}" }; + } // Lists matching subscriptions. - rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse); + rpc ListSubscriptions(ListSubscriptionsRequest) returns (ListSubscriptionsResponse) { + option (google.api.http) = { get: "/v1/{project=projects/*}/subscriptions" }; + } // Deletes an existing subscription. All pending messages in the subscription // are immediately dropped. Calls to Pull after deletion will return // NOT_FOUND. After a subscription is deleted, a new one may be created with // the same name, but the new one has no association with the old // subscription, or its topic unless the same topic is specified. - rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty); + rpc DeleteSubscription(DeleteSubscriptionRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{subscription=projects/*/subscriptions/*}" }; + } // Modifies the ack deadline for a specific message. This method is useful to // indicate that more time is needed to process a message by the subscriber, // or to make the message available for redelivery if the processing was // interrupted. - rpc ModifyAckDeadline(ModifyAckDeadlineRequest) returns (google.protobuf.Empty); + rpc ModifyAckDeadline(ModifyAckDeadlineRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{subscription=projects/*/subscriptions/*}:modifyAckDeadline" body: "*" }; + } // Acknowledges the messages associated with the ack tokens in the // AcknowledgeRequest. The Pub/Sub system can remove the relevant messages @@ -60,13 +71,17 @@ service Subscriber { // Acknowledging a message whose ack deadline has expired may succeed, // but such a message may be redelivered later. Acknowledging a message more // than once will not result in an error. - rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty); + rpc Acknowledge(AcknowledgeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{subscription=projects/*/subscriptions/*}:acknowledge" body: "*" }; + } // Pulls messages from the server. Returns an empty list if there are no // messages available in the backlog. The server may return UNAVAILABLE if // there are too many concurrent pull requests pending for the given // subscription. - rpc Pull(PullRequest) returns (PullResponse); + rpc Pull(PullRequest) returns (PullResponse) { + option (google.api.http) = { post: "/v1/{subscription=projects/*/subscriptions/*}:pull" body: "*" }; + } // Modifies the PushConfig for a specified subscription. // @@ -75,34 +90,49 @@ service Subscriber { // attributes of a push subscription. Messages will accumulate for // delivery continuously through the call regardless of changes to the // PushConfig. - rpc ModifyPushConfig(ModifyPushConfigRequest) returns (google.protobuf.Empty); + rpc ModifyPushConfig(ModifyPushConfigRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{subscription=projects/*/subscriptions/*}:modifyPushConfig" body: "*" }; + } } // The service that an application uses to manipulate topics, and to send // messages to a topic. service Publisher { // Creates the given topic with the given name. - rpc CreateTopic(Topic) returns (Topic); + rpc CreateTopic(Topic) returns (Topic) { + option (google.api.http) = { put: "/v1/{name=projects/*/topics/*}" body: "*" }; + } // Adds one or more messages to the topic. Returns NOT_FOUND if the topic does - // not exist. - rpc Publish(PublishRequest) returns (PublishResponse); + // not exist. The message payload must not be empty; it must contain either a + // non-empty data field, or at least one attribute. + rpc Publish(PublishRequest) returns (PublishResponse) { + option (google.api.http) = { post: "/v1/{topic=projects/*/topics/*}:publish" body: "*" }; + } // Gets the configuration of a topic. - rpc GetTopic(GetTopicRequest) returns (Topic); + rpc GetTopic(GetTopicRequest) returns (Topic) { + option (google.api.http) = { get: "/v1/{topic=projects/*/topics/*}" }; + } // Lists matching topics. - rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse); + rpc ListTopics(ListTopicsRequest) returns (ListTopicsResponse) { + option (google.api.http) = { get: "/v1/{project=projects/*}/topics" }; + } // Lists the name of the subscriptions for this topic. - rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse); + rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest) returns (ListTopicSubscriptionsResponse) { + option (google.api.http) = { get: "/v1/{topic=projects/*/topics/*}/subscriptions" }; + } // Deletes the topic with the given name. Returns NOT_FOUND if the topic does // not exist. After a topic is deleted, a new topic may be created with the // same name; this is an entirely new topic with none of the old // configuration or subscriptions. Existing subscriptions to this topic are // not deleted, but their `topic` field is set to `_deleted-topic_`. - rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty); + rpc DeleteTopic(DeleteTopicRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { delete: "/v1/{topic=projects/*/topics/*}" }; + } } // A topic resource. @@ -116,7 +146,8 @@ message Topic { string name = 1; } -// A message data and its attributes. +// A message data and its attributes. The message payload must not be empty; +// it must contain either a non-empty data field, or at least one attribute. message PubsubMessage { // The message payload. For JSON requests, the value of this field must be // base64-encoded. @@ -236,10 +267,9 @@ message Subscription { // acknowledged, it is an outstanding message and will not be delivered // again during that time (on a best-effort basis). // - // For pull delivery this value - // is used as the initial value for the ack deadline. It may be overridden - // for each message using its corresponding ack_id by calling - // ModifyAckDeadline. + // For pull delivery this value is used as the initial value for the ack + // deadline. To override this value for a given message, call + // ModifyAckDeadline with the corresponding ack_id. // // For push delivery, this value is also used to set the request timeout for // the call to the push endpoint. @@ -247,7 +277,7 @@ message Subscription { // If the subscriber never acknowledges the message, the Pub/Sub // system will eventually redeliver the message. // - // If this parameter is not set, the default value of 60 seconds is used. + // If this parameter is not set, the default value of 10 seconds is used. int32 ack_deadline_seconds = 5; }