Skip to content

Commit f5f268f

Browse files
Google APIscopybara-github
authored andcommitted
Add DetachSubscription RPC
PiperOrigin-RevId: 313276022
1 parent af7903d commit f5f268f

2 files changed

Lines changed: 31 additions & 2 deletions

File tree

google/pubsub/v1/pubsub.proto

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ service Publisher {
8888
option (google.api.method_signature) = "project";
8989
}
9090

91-
// Lists the names of the subscriptions on this topic.
91+
// Lists the names of the attached subscriptions on this topic.
9292
rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest)
9393
returns (ListTopicSubscriptionsResponse) {
9494
option (google.api.http) = {
@@ -122,6 +122,17 @@ service Publisher {
122122
};
123123
option (google.api.method_signature) = "topic";
124124
}
125+
126+
// Detaches a subscription from this topic. All messages retained in the
127+
// subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
128+
// will return FAILED_PRECONDITION. If the subscription is a push
129+
// subscription, pushes to the endpoint will stop.
130+
rpc DetachSubscription(DetachSubscriptionRequest)
131+
returns (DetachSubscriptionResponse) {
132+
option (google.api.http) = {
133+
post: "/v1/{subscription=projects/*/subscriptions/*}:detach"
134+
};
135+
}
125136
}
126137

127138
message MessageStoragePolicy {
@@ -300,7 +311,7 @@ message ListTopicSubscriptionsRequest {
300311

301312
// Response for the `ListTopicSubscriptions` method.
302313
message ListTopicSubscriptionsResponse {
303-
// The names of the subscriptions that match the request.
314+
// The names of subscriptions attached to the topic specified in the request.
304315
repeated string subscriptions = 1 [(google.api.resource_reference) = {
305316
type: "pubsub.googleapis.com/Subscription"
306317
}];
@@ -350,6 +361,20 @@ message DeleteTopicRequest {
350361
];
351362
}
352363

364+
// Request for the DetachSubscription method.
365+
message DetachSubscriptionRequest {
366+
// Required. The subscription to detach.
367+
// Format is `projects/{project}/subscriptions/{subscription}`.
368+
string subscription = 1 [
369+
(google.api.field_behavior) = REQUIRED,
370+
(google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" }
371+
];
372+
}
373+
374+
// Response for the DetachSubscription method.
375+
// Reserved for future use.
376+
message DetachSubscriptionResponse {}
377+
353378
// The service that an application uses to manipulate subscriptions and to
354379
// consume messages from a subscription via the `Pull` method or by
355380
// establishing a bi-directional stream using the `StreamingPull` method.

google/pubsub/v1/pubsub_grpc_service_config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"service": "google.pubsub.v1.Publisher",
1515
"method": "DeleteTopic"
1616
},
17+
{
18+
"service": "google.pubsub.v1.Publisher",
19+
"method": "DetachSubscription"
20+
},
1721
{
1822
"service": "google.pubsub.v1.Publisher",
1923
"method": "SetIamPolicy"

0 commit comments

Comments
 (0)