Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: re-generated to pick up changes in the API or client library generator #114

Merged
merged 19 commits into from
Jun 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
48363bb
Integrate Python GAPIC Microgenerator in googleapis. This PR uses usi…
yoshi-automation Jun 5, 2020
7db74ee
chore(python): create thread_safety doc
yoshi-automation Jun 5, 2020
04079c3
Removing the experimental tag from dead letter policy related fields.
yoshi-automation Jun 5, 2020
ba9ebf0
chore(python): remove extra #!/bin/bash
yoshi-automation Jun 5, 2020
e033f13
chore(python): remove one remaining extra bash line
yoshi-automation Jun 5, 2020
67c9e96
Upgrade protoc-docs-plugin version to 0.7.0 to fix unstable docstrings.
yoshi-automation Jun 5, 2020
ed0f227
Add DetachSubscription RPC
yoshi-automation Jun 5, 2020
0ba1013
bazel: update protobuf, rules_go, gazelle, and gapic-generator-go ver…
yoshi-automation Jun 5, 2020
c8b53e2
Use correct resource type for DetachSubscriptionRequest
yoshi-automation Jun 5, 2020
ce7065d
docs: update python docs template
yoshi-automation Jun 5, 2020
1d67056
feat: add templates for python samples projects
yoshi-automation Jun 5, 2020
a7aeb4b
chore: update default ignores for Python libraries
yoshi-automation Jun 5, 2020
1d360b5
feat: allow custom python versions in noxfile
yoshi-automation Jun 5, 2020
baebcb5
docs: Add comment for MessageStoragePolicy message
yoshi-automation Jun 5, 2020
3f9341b
Drop the experimental tag on the Subscription filter and retry policy…
yoshi-automation Jun 5, 2020
4683a77
Add "detached" bool to Subscription
yoshi-automation Jun 5, 2020
524f183
chore: fix spacing in docs
busunkim96 Jun 5, 2020
4980d1c
chore: add link to PR with fix
busunkim96 Jun 5, 2020
205dff0
Merge branch 'master' into autosynth
plamut Jun 9, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add DetachSubscription RPC
PiperOrigin-RevId: 313276022

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue May 26 15:11:32 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: f5f268f5293e60143ac742a4eeb7dd6306ebf505
Source-Link: googleapis/googleapis@f5f268f
  • Loading branch information
yoshi-automation committed Jun 5, 2020
commit ed0f227f46f0818382993692a99db74fd4cd16bd
75 changes: 74 additions & 1 deletion google/cloud/pubsub_v1/gapic/publisher_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def list_topic_subscriptions(
metadata=None,
):
"""
Lists the names of the subscriptions on this topic.
Lists the names of the attached subscriptions on this topic.

Example:
>>> from google.cloud import pubsub_v1
Expand Down Expand Up @@ -1204,3 +1204,76 @@ def test_iam_permissions(
return self._inner_api_calls["test_iam_permissions"](
request, retry=retry, timeout=timeout, metadata=metadata
)

def detach_subscription(
self,
subscription,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Detaches a subscription from this topic. All messages retained in
the subscription are dropped. Subsequent ``Pull`` and ``StreamingPull``
requests will return FAILED_PRECONDITION. If the subscription is a push
subscription, pushes to the endpoint will stop.

Example:
>>> from google.cloud import pubsub_v1
>>>
>>> client = pubsub_v1.PublisherClient()
>>>
>>> subscription = client.topic_path('[PROJECT]', '[TOPIC]')
>>>
>>> response = client.detach_subscription(subscription)

Args:
subscription (str): Required. The subscription to detach. Format is
``projects/{project}/subscriptions/{subscription}``.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
be retried using a default configuration.
timeout (Optional[float]): The amount of time, in seconds, to wait
for the request to complete. Note that if ``retry`` is
specified, the timeout applies to each individual attempt.
metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
that is provided to the method.

Returns:
A :class:`~google.cloud.pubsub_v1.types.DetachSubscriptionResponse` instance.

Raises:
google.api_core.exceptions.GoogleAPICallError: If the request
failed for any reason.
google.api_core.exceptions.RetryError: If the request failed due
to a retryable error and retry attempts failed.
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "detach_subscription" not in self._inner_api_calls:
self._inner_api_calls[
"detach_subscription"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.detach_subscription,
default_retry=self._method_configs["DetachSubscription"].retry,
default_timeout=self._method_configs["DetachSubscription"].timeout,
client_info=self._client_info,
)

request = pubsub_pb2.DetachSubscriptionRequest(subscription=subscription)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("subscription", subscription)]
except AttributeError:
pass
else:
routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
routing_header
)
metadata.append(routing_metadata)

return self._inner_api_calls["detach_subscription"](
request, retry=retry, timeout=timeout, metadata=metadata
)
6 changes: 6 additions & 0 deletions google/cloud/pubsub_v1/gapic/publisher_client_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"google.pubsub.v1.Publisher": {
"retry_codes": {
"idempotent": ["ABORTED", "UNAVAILABLE", "UNKNOWN"],
"non_idempotent2": [],
"non_idempotent": ["UNAVAILABLE"],
"idempotent2": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"none": [],
Expand Down Expand Up @@ -99,6 +100,11 @@
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
},
"DetachSubscription": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent2",
"retry_params_name": "default",
},
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def list_topics(self):
def list_topic_subscriptions(self):
"""Return the gRPC stub for :meth:`PublisherClient.list_topic_subscriptions`.

Lists the names of the subscriptions on this topic.
Lists the names of the attached subscriptions on this topic.

Returns:
Callable: A callable which accepts the appropriate
Expand Down Expand Up @@ -278,3 +278,19 @@ def test_iam_permissions(self):
deserialized response object.
"""
return self._stubs["iam_policy_stub"].TestIamPermissions

@property
def detach_subscription(self):
"""Return the gRPC stub for :meth:`PublisherClient.detach_subscription`.

Detaches a subscription from this topic. All messages retained in
the subscription are dropped. Subsequent ``Pull`` and ``StreamingPull``
requests will return FAILED_PRECONDITION. If the subscription is a push
subscription, pushes to the endpoint will stop.

Returns:
Callable: A callable which accepts the appropriate
deserialized request object and returns a
deserialized response object.
"""
return self._stubs["publisher_stub"].DetachSubscription
29 changes: 27 additions & 2 deletions google/cloud/pubsub_v1/proto/pubsub.proto
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ service Publisher {
option (google.api.method_signature) = "project";
}

// Lists the names of the subscriptions on this topic.
// Lists the names of the attached subscriptions on this topic.
rpc ListTopicSubscriptions(ListTopicSubscriptionsRequest)
returns (ListTopicSubscriptionsResponse) {
option (google.api.http) = {
Expand Down Expand Up @@ -122,6 +122,17 @@ service Publisher {
};
option (google.api.method_signature) = "topic";
}

// Detaches a subscription from this topic. All messages retained in the
// subscription are dropped. Subsequent `Pull` and `StreamingPull` requests
// will return FAILED_PRECONDITION. If the subscription is a push
// subscription, pushes to the endpoint will stop.
rpc DetachSubscription(DetachSubscriptionRequest)
returns (DetachSubscriptionResponse) {
option (google.api.http) = {
post: "/v1/{subscription=projects/*/subscriptions/*}:detach"
};
}
}

message MessageStoragePolicy {
Expand Down Expand Up @@ -300,7 +311,7 @@ message ListTopicSubscriptionsRequest {

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

// Request for the DetachSubscription method.
message DetachSubscriptionRequest {
// Required. The subscription to detach.
// Format is `projects/{project}/subscriptions/{subscription}`.
string subscription = 1 [
(google.api.field_behavior) = REQUIRED,
(google.api.resource_reference) = { type: "pubsub.googleapis.com/Topic" }
];
}

// Response for the DetachSubscription method.
// Reserved for future use.
message DetachSubscriptionResponse {}

// The service that an application uses to manipulate subscriptions and to
// consume messages from a subscription via the `Pull` method or by
// establishing a bi-directional stream using the `StreamingPull` method.
Expand Down
Loading