-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathowlbot.py
More file actions
102 lines (99 loc) · 56.2 KB
/
owlbot.py
File metadata and controls
102 lines (99 loc) · 56.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Copyright 2026 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
#
# https://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.
import synthtool as s
from synthtool.languages import java
service = 'pubsub'
version = 'v1'
GET_IAM_POLICY_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Gets the access control policy for a resource. Returns an empty policy if the resource exists\n * and does not have a policy set.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy response = topicAdminClient.getIamPolicy(formattedResource);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy is being requested. See the\n * operation documentation for the appropriate value for this field.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead.\n */\n @Deprecated\n public final Policy getIamPolicy(String resource) {\n GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); \n return getIamPolicy(request);\n }\n'
GET_IAM_POLICY_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Gets the access control policy for a resource. Returns an empty policy if the resource exists\n * and does not have a policy set.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy is being requested. See the\n * operation documentation for the appropriate value for this field.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead.\n */\n @Deprecated\n public final Policy getIamPolicy(String resource) {\n GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); \n return getIamPolicy(request);\n }\n'
GET_IAM_POLICY_PREVIOUS = '(\\s+public final Policy getIamPolicy\\(GetIamPolicyRequest request\\) {\\n\\s+return .*\\n\\s+})'
SET_IAM_POLICY_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Sets the access control policy on the specified resource. Replaces any existing policy.\n *\n * <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy policy = Policy.newBuilder().build();\n * Policy response = topicAdminClient.setIamPolicy(formattedResource, policy);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy is being specified. See the\n * operation documentation for the appropriate value for this field.\n * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the\n * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud\n * Platform services (such as Projects) might reject them.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead.\n */\n @Deprecated\n public final Policy setIamPolicy(String resource, Policy policy) { \n SetIamPolicyRequest request = \n SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); \n return setIamPolicy(request); \n }\n'
SET_IAM_POLICY_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Sets the access control policy on the specified resource. Replaces any existing policy.\n *\n * <p>Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy policy = Policy.newBuilder().build();\n * Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy is being specified. See the\n * operation documentation for the appropriate value for this field.\n * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the\n * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud\n * Platform services (such as Projects) might reject them.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead.\n */\n @Deprecated\n public final Policy setIamPolicy(String resource, Policy policy) { \n SetIamPolicyRequest request = \n SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); \n return setIamPolicy(request); \n }\n'
SET_IAM_POLICY_PREVIOUS = '(\\s+public final Policy setIamPolicy\\(SetIamPolicyRequest request\\) {\\n\\s+return .*\\n\\s+})'
TEST_IAM_PERMISSIONS_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Returns permissions that a caller has on the specified resource. If the resource does not\n * exist, this will return an empty set of permissions, not a NOT_FOUND error.\n *\n * <p>Note: This operation is designed to be used for building permission-aware UIs and\n * command-line tools, not for authorization checking. This operation may "fail open" without\n * warning.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * List<String> permissions = new ArrayList<>();\n * TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy detail is being requested. See the\n * operation documentation for the appropriate value for this field.\n * @param permissions The set of permissions to check for the `resource`. Permissions with\n * wildcards (such as \'*\' or \'storage.*\') are not allowed. For more information see\n * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead.\n */\n @Deprecated\n public final TestIamPermissionsResponse testIamPermissions( \n String resource, List<String> permissions) { \n TestIamPermissionsRequest request = \n TestIamPermissionsRequest.newBuilder() \n .setResource(resource) \n .addAllPermissions(permissions) \n .build(); \n return testIamPermissions(request); \n }\n'
TEST_IAM_PERMISSIONS_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Returns permissions that a caller has on the specified resource. If the resource does not\n * exist, this will return an empty set of permissions, not a NOT_FOUND error.\n *\n * <p>Note: This operation is designed to be used for building permission-aware UIs and\n * command-line tools, not for authorization checking. This operation may "fail open" without\n * warning.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * List<String> permissions = new ArrayList<>();\n * TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);\n * }\n * </code></pre>\n *\n * @param resource REQUIRED: The resource for which the policy detail is being requested. See the\n * operation documentation for the appropriate value for this field.\n * @param permissions The set of permissions to check for the `resource`. Permissions with\n * wildcards (such as \'*\' or \'storage.*\') are not allowed. For more information see\n * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead.\n */\n @Deprecated\n public final TestIamPermissionsResponse testIamPermissions( \n String resource, List<String> permissions) { \n TestIamPermissionsRequest request = \n TestIamPermissionsRequest.newBuilder() \n .setResource(resource) \n .addAllPermissions(permissions) \n .build(); \n return testIamPermissions(request); \n }\n'
TEST_IAM_PERMISSIONS_PREVIOUS = '(\\s+public final TestIamPermissionsResponse testIamPermissions\\(TestIamPermissionsRequest request\\) {\\n\\s+return .*\\n\\s+})'
CREATE_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Creates the given topic with the given name. See the <a\n * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name\n * rules</a>.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * Topic response = topicAdminClient.createTopic(name);\n * }\n * </code></pre>\n *\n * @param name Required. The name of the topic. It must have the format\n * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only\n * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`),\n * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in\n * length, and it must not start with `"goog"`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #createTopic(TopicName)} instead.\n */\n @Deprecated\n public final Topic createTopic(ProjectTopicName name) {\n Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build();\n return createTopic(request);\n }\n'
CREATE_TOPIC_PREVIOUS = '(\\s+public final Topic createTopic\\(String name\\) {\\n\\s+.*\\n\\s+return.*\\n\\s+})'
DELETE_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Deletes the topic with the given name. Returns `NOT_FOUND` if the topic does not exist. After a\n * topic is deleted, a new topic may be created with the same name; this is an entirely new topic\n * with none of the old configuration or subscriptions. Existing subscriptions to this topic are\n * not deleted, but their `topic` field is set to `_deleted-topic_`.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * topicAdminClient.deleteTopic(topic);\n * }\n * </code></pre>\n *\n * @param topic Required. Name of the topic to delete. Format is\n * `projects/{project}/topics/{topic}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #deleteTopic(TopicName)} instead.\n */\n @Deprecated\n public final void deleteTopic(ProjectTopicName topic) {\n DeleteTopicRequest request =\n DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();\n deleteTopic(request);\n }\n'
GET_TOPIC_PREVIOUS = '(\\s+public final Topic getTopic\\(String topic\\) {\\n\\s+.*\\n\\s+return.*\\n\\s+})'
GET_TOPIC = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Gets the configuration of a topic.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * Topic response = topicAdminClient.getTopic(topic);\n * }\n * </code></pre>\n *\n * @param topic Required. The name of the topic to get. Format is\n * `projects/{project}/topics/{topic}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #getTopic(TopicName)} instead.\n */\n @Deprecated\n public final Topic getTopic(ProjectTopicName topic) {\n GetTopicRequest request =\n GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();\n return getTopic(request);\n }\n'
DELETE_TOPIC_PREVIOUS = '(\\s+public final void deleteTopic\\(String topic\\) {\\n\\s+.*\\n\\s+deleteTopic.*\\n\\s+})'
LIST_TOPIC_SUBSCRIPTIONS = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Lists the names of the subscriptions on this topic.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {\n * // doThingsWith(element);\n * }\n * }\n * </code></pre>\n *\n * @param topic Required. The name of the topic that subscriptions are attached to. Format is\n * `projects/{project}/topics/{topic}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #listTopicSubscriptions(TopicName)} instead.\n */\n @Deprecated\n public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectTopicName topic) {\n ListTopicSubscriptionsRequest request =\n ListTopicSubscriptionsRequest.newBuilder()\n .setTopic(topic == null ? null : topic.toString())\n .build();\n return listTopicSubscriptions(request);\n }\n'
LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS = '(\\s+public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions\\(String topic\\) {\\n\\s+.*\\n\\s+.*\\n\\s+return.*\\n\\s+})'
CREATE_SUBSCRIPTION_PREVIOUS = '(\\s+public final Subscription createSubscription\\(Subscription request\\) {\\n\\s+return.*\\n\\s+})'
CREATE_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD\n /**\n * Creates a subscription to a given topic. See the <a\n * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name\n * rules</a>. If the subscription already exists, returns `ALREADY_EXISTS`. If the\n * corresponding topic doesn\'t exist, returns `NOT_FOUND`.\n *\n * <p>If the name is not provided in the request, the server will assign a random name for this\n * subscription on the same project as the topic, conforming to the [resource name\n * format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is\n * populated in the returned Subscription object. Note that for REST API requests, you must\n * specify a name in the request.\n *\n * <p>Sample code:\n *\n * <pre><code>\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * PushConfig pushConfig = PushConfig.newBuilder().build();\n * int ackDeadlineSeconds = 0;\n * Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);\n * }\n * </code></pre>\n *\n * @param name Required. The name of the subscription. It must have the format\n * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a\n * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores\n * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3\n * and 255 characters in length, and it must not start with `"goog"`.\n * @param topic Required. The name of the topic from which this subscription is receiving\n * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be\n * `_deleted-topic_` if the topic has been deleted.\n * @param pushConfig If push delivery is used with this subscription, this field is used to\n * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack\n * messages using API methods.\n * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits\n * for the subscriber to acknowledge receipt before resending the message. In the interval\n * after the message is delivered and before it is acknowledged, it is considered to be\n * <i>outstanding</i>. During that time period, the message will not be\n * redelivered (on a best-effort basis).\n * <p>For pull subscriptions, this value is used as the initial value for the ack deadline. To\n * override this value for a given message, call `ModifyAckDeadline` with the corresponding\n * `ack_id` if using non-streaming pull or send the `ack_id` in a\n * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline\n * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds\n * (10 minutes). If this parameter is 0, a default value of 10 seconds is used.\n * <p>For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n * <p>If the subscriber never acknowledges the message, the Pub/Sub system will eventually\n * redeliver the message.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} instead.\n */\n @Deprecated\n public final Subscription createSubscription(\n ProjectSubscriptionName name,\n ProjectTopicName topic,\n PushConfig pushConfig,\n int ackDeadlineSeconds) {\n Subscription request =\n Subscription.newBuilder()\n .setName(name == null ? null : name.toString())\n .setTopic(topic == null ? null : topic.toString())\n .setPushConfig(pushConfig)\n .setAckDeadlineSeconds(ackDeadlineSeconds)\n .build();\n return createSubscription(request);\n }\n \n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Creates a subscription to a given topic. See the [resource name rules]\n * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already\n * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn\'t exist, returns\n * `NOT_FOUND`.\n *\n * <p>If the name is not provided in the request, the server will assign a random name for this\n * subscription on the same project as the topic, conforming to the [resource name format]\n * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in\n * the returned Subscription object. Note that for REST API requests, you must specify a name in\n * the request.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();\n * PushConfig pushConfig = PushConfig.newBuilder().build();\n * int ackDeadlineSeconds = 2135351438;\n * Subscription response =\n * subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);\n * }\n * }</pre>\n *\n * @param name Required. The name of the subscription. It must have the format\n * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a\n * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores\n * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3\n * and 255 characters in length, and it must not start with `"goog"`.\n * @param topic Required. The name of the topic from which this subscription is receiving\n * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be\n * `_deleted-topic_` if the topic has been deleted.\n * @param pushConfig If push delivery is used with this subscription, this field is used to\n * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack\n * messages using API methods.\n * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits\n * for the subscriber to acknowledge receipt before resending the message. In the interval\n * after the message is delivered and before it is acknowledged, it is considered to be\n * <i>outstanding</i>. During that time period, the message will not be\n * redelivered (on a best-effort basis).\n * <p>For pull subscriptions, this value is used as the initial value for the ack deadline. To\n * override this value for a given message, call `ModifyAckDeadline` with the corresponding\n * `ack_id` if using non-streaming pull or send the `ack_id` in a\n * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline\n * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds\n * (10 minutes). If this parameter is 0, a default value of 10 seconds is used.\n * <p>For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n * <p>If the subscriber never acknowledges the message, the Pub/Sub system will eventually\n * redeliver the message.\n * @deprecated Use {@link #createSubscription(SubscriptionName, String, PushConfig, int)} instead.\n */\n @Deprecated\n public final Subscription createSubscription(\n ProjectSubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) {\n Subscription request =\n Subscription.newBuilder()\n .setName(name == null ? null : name.toString())\n .setTopic(topic)\n .setPushConfig(pushConfig)\n .setAckDeadlineSeconds(ackDeadlineSeconds)\n .build();\n return createSubscription(request);\n }\n \n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Creates a subscription to a given topic. See the [resource name rules]\n * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already\n * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn\'t exist, returns\n * `NOT_FOUND`.\n *\n * <p>If the name is not provided in the request, the server will assign a random name for this\n * subscription on the same project as the topic, conforming to the [resource name format]\n * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in\n * the returned Subscription object. Note that for REST API requests, you must specify a name in\n * the request.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");\n * PushConfig pushConfig = PushConfig.newBuilder().build();\n * int ackDeadlineSeconds = 2135351438;\n * Subscription response =\n * subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);\n * }\n * }</pre>\n *\n * @param name Required. The name of the subscription. It must have the format\n * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a\n * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores\n * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3\n * and 255 characters in length, and it must not start with `"goog"`.\n * @param topic Required. The name of the topic from which this subscription is receiving\n * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be\n * `_deleted-topic_` if the topic has been deleted.\n * @param pushConfig If push delivery is used with this subscription, this field is used to\n * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack\n * messages using API methods.\n * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits\n * for the subscriber to acknowledge receipt before resending the message. In the interval\n * after the message is delivered and before it is acknowledged, it is considered to be\n * <i>outstanding</i>. During that time period, the message will not be\n * redelivered (on a best-effort basis).\n * <p>For pull subscriptions, this value is used as the initial value for the ack deadline. To\n * override this value for a given message, call `ModifyAckDeadline` with the corresponding\n * `ack_id` if using non-streaming pull or send the `ack_id` in a\n * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline\n * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds\n * (10 minutes). If this parameter is 0, a default value of 10 seconds is used.\n * <p>For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n * <p>If the subscriber never acknowledges the message, the Pub/Sub system will eventually\n * redeliver the message.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} instead.\n */\n @Deprecated\n public final Subscription createSubscription(\n ProjectSubscriptionName name,\n TopicName topic,\n PushConfig pushConfig,\n int ackDeadlineSeconds) {\n Subscription request =\n Subscription.newBuilder()\n .setName(name == null ? null : name.toString())\n .setTopic(topic == null ? null : topic.toString())\n .setPushConfig(pushConfig)\n .setAckDeadlineSeconds(ackDeadlineSeconds)\n .build();\n return createSubscription(request);\n }\n'
GET_SUBSCRIPTION_PREVIOUS = '(\\s+public final Subscription getSubscription\\(GetSubscriptionRequest request\\) {\\n\\s+return.*\\n\\s+})'
GET_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Gets the configuration details of a subscription.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * Subscription response = subscriptionAdminClient.getSubscription(subscription);\n * }\n * }</pre>\n *\n * @param subscription Required. The name of the subscription to get. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #getSubscription(SubscriptionName)} instead. \n */\n @Deprecated\n public final Subscription getSubscription(ProjectSubscriptionName subscription) {\n GetSubscriptionRequest request =\n GetSubscriptionRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .build();\n return getSubscription(request);\n }\n'
DELETE_SUBSCRIPTION_PREVIOUS = '(\\s+public final void deleteSubscription\\(DeleteSubscriptionRequest request\\) {\\n\\s+deleteSubscription.*\\n\\s+})'
DELETE_SUBSCRIPTION = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Deletes an existing subscription. All messages retained in the subscription are immediately\n * dropped. Calls to `Pull` after deletion will return `NOT_FOUND`. After a subscription is\n * deleted, a new one may be created with the same name, but the new one has no association with\n * the old subscription or its topic unless the same topic is specified.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * subscriptionAdminClient.deleteSubscription(subscription);\n * }\n * }</pre>\n *\n * @param subscription Required. The subscription to delete. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #deleteSubscription(SubscriptionName)} instead.\n */\n @Deprecated\n public final void deleteSubscription(ProjectSubscriptionName subscription) {\n DeleteSubscriptionRequest request =\n DeleteSubscriptionRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .build();\n deleteSubscription(request);\n }\n'
MODIFY_ACK_DEADLINE_PREVIOUS = '(\\s+public final void modifyAckDeadline\\(ModifyAckDeadlineRequest request\\) {\\n\\s+modifyAckDeadline.*\\n\\s+})'
MODIFY_ACK_DEADLINE = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Modifies the ack deadline for a specific message. This method is useful to indicate that more\n * time is needed to process a message by the subscriber, or to make the message available for\n * redelivery if the processing was interrupted. Note that this does not modify the\n * subscription-level `ackDeadlineSeconds` used for subsequent messages.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * List<String> ackIds = new ArrayList<>();\n * int ackDeadlineSeconds = 2135351438;\n * subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);\n * }\n * }</pre>\n *\n * @param subscription Required. The name of the subscription. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @param ackIds Required. List of acknowledgment IDs.\n * @param ackDeadlineSeconds Required. The new ack deadline with respect to the time this request\n * was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will\n * expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might\n * immediately make the message available for delivery to another subscriber client. This\n * typically results in an increase in the rate of message redeliveries (that is, duplicates).\n * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is\n * 600 seconds (10 minutes).\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #modifyAckDeadline(SubscriptionName, List<String>, int)} instead.\n */\n @Deprecated\n final void modifyAckDeadline(\n ProjectSubscriptionName subscription, List<String> ackIds, int ackDeadlineSeconds) {\n ModifyAckDeadlineRequest request =\n ModifyAckDeadlineRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .addAllAckIds(ackIds)\n .setAckDeadlineSeconds(ackDeadlineSeconds)\n .build();\n modifyAckDeadline(request);\n }\n'
ACKNOWLEDGE_PREVIOUS = '(\\s+public final void acknowledge\\(AcknowledgeRequest request\\) {\\n\\s+acknowledge.*\\n\\s+})'
ACKNOWLEDGE = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The\n * Pub/Sub system can remove the relevant messages from the subscription.\n *\n * <p>Acknowledging a message whose ack deadline has expired may succeed, but such a message may\n * be redelivered later. Acknowledging a message more than once will not result in an error.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * List<String> ackIds = new ArrayList<>();\n * subscriptionAdminClient.acknowledge(subscription, ackIds);\n * }\n * }</pre>\n *\n * @param subscription Required. The subscription whose message is being acknowledged. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @param ackIds Required. The acknowledgment ID for the messages being acknowledged that was\n * returned by the Pub/Sub system in the `Pull` response. Must not be empty.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #acknowledge(SubscriptionName, List<String>)} instead.\n */\n @Deprecated\n public final void acknowledge(ProjectSubscriptionName subscription, List<String> ackIds) {\n AcknowledgeRequest request =\n AcknowledgeRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .addAllAckIds(ackIds)\n .build();\n acknowledge(request);\n }\n'
PULL_PREVIOUS = '(\\s+public final PullResponse pull\\(PullRequest request\\) {\\n\\s+return.*\\n\\s+})'
PULL = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many\n * concurrent pull requests pending for the given subscription.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * int maxMessages = 496131527;\n * PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);\n * }\n * }</pre>\n *\n * @param subscription Required. The subscription from which messages should be pulled. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @param maxMessages Required. The maximum number of messages to return for this request. Must be\n * a positive integer. The Pub/Sub system may return fewer than the number specified.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #pull(SubscriptionName, int)} instead.\n */\n @Deprecated\n public final PullResponse pull(ProjectSubscriptionName subscription, int maxMessages) {\n PullRequest request =\n PullRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .setMaxMessages(maxMessages)\n .build();\n return pull(request);\n }\n \n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many\n * concurrent pull requests pending for the given subscription.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * boolean returnImmediately = true;\n * int maxMessages = 496131527;\n * PullResponse response =\n * subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);\n * }\n * }</pre>\n *\n * @param subscription Required. The subscription from which messages should be pulled. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @param returnImmediately Optional. If this field set to true, the system will respond\n * immediately even if it there are no messages available to return in the `Pull` response.\n * Otherwise, the system may wait (for a bounded amount of time) until at least one message is\n * available, rather than returning no messages. Warning: setting this field to `true` is\n * discouraged because it adversely impacts the performance of `Pull` operations. We recommend\n * that users do not set this field.\n * @param maxMessages Required. The maximum number of messages to return for this request. Must be\n * a positive integer. The Pub/Sub system may return fewer than the number specified.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #pull(SubscriptionName, boolean, int)} instead.\n */\n @Deprecated\n final PullResponse pull(\n ProjectSubscriptionName subscription, boolean returnImmediately, int maxMessages) {\n PullRequest request =\n PullRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .setReturnImmediately(returnImmediately)\n .setMaxMessages(maxMessages)\n .build();\n return pull(request);\n }\n'
MODIFY_PUSH_CONFIG_PREVIOUS = '(\\s+public final void modifyPushConfig\\(ModifyPushConfigRequest request\\) {\\n\\s+modifyPushConfig.*\\n\\s+})'
MODIFY_PUSH_CONFIG = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Modifies the `PushConfig` for a specified subscription.\n *\n * <p>This may be used to change a push subscription to a pull one (signified by an empty\n * `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push\n * subscription. Messages will accumulate for delivery continuously through the call regardless of\n * changes to the `PushConfig`.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * PushConfig pushConfig = PushConfig.newBuilder().build();\n * subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);\n * }\n * }</pre>\n *\n * @param subscription Required. The name of the subscription. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @param pushConfig Required. The push configuration for future deliveries.\n * <p>An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages\n * from the given subscription and allow messages to be pulled and acknowledged - effectively\n * pausing the subscription if `Pull` or `StreamingPull` is not called.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use {@link #modifyPushConfig(SubscriptionName, PushConfig)} instead.\n */\n @Deprecated\n public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) {\n ModifyPushConfigRequest request =\n ModifyPushConfigRequest.newBuilder()\n .setSubscription(subscription == null ? null : subscription.toString())\n .setPushConfig(pushConfig)\n .build();\n modifyPushConfig(request);\n }\n'
CREATE_SNAPSHOT_PREVIOUS = '(\\s+public final Snapshot createSnapshot\\(CreateSnapshotRequest request\\) {\\n\\s+return.*\\n\\s+})'
CREATE_SNAPSHOT = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Creates a snapshot from the requested subscription. Snapshots are used in\n * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to\n * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of\n * messages in an existing subscription to the state captured by a snapshot. If the snapshot\n * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn\'t exist, returns\n * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would\n * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the\n * `Snapshot.expire_time` field. If the name is not provided in the request, the server will\n * assign a random name for this snapshot on the same project as the subscription, conforming to\n * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The\n * generated name is populated in the returned Snapshot object. Note that for REST API requests,\n * you must specify a name in the request.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);\n * }\n * }</pre>\n *\n * @param name Required. User-provided name for this snapshot. If the name is not provided in the\n * request, the server will assign a random name for this snapshot on the same project as the\n * subscription. Note that for REST API requests, you must specify a name. See the <a\n * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name\n * rules</a>. Format is `projects/{project}/snapshots/{snap}`.\n * @param subscription Required. The subscription whose backlog the snapshot retains.\n * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the\n * subscription. More precisely, this is defined as the messages in the subscription\'s backlog\n * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as\n * well as: (b) Any messages published to the subscription\'s topic following the successful\n * completion of the CreateSnapshot request. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use Use {@link #createSnapshot(SnapshotName, SubscriptionName)} instead.\n */\n @Deprecated\n public final Snapshot createSnapshot(\n ProjectSnapshotName name, ProjectSubscriptionName subscription) {\n CreateSnapshotRequest request =\n CreateSnapshotRequest.newBuilder()\n .setName(name == null ? null : name.toString())\n .setSubscription(subscription == null ? null : subscription.toString())\n .build();\n return createSnapshot(request);\n }\n \n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Creates a snapshot from the requested subscription. Snapshots are used in\n * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to\n * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of\n * messages in an existing subscription to the state captured by a snapshot. If the snapshot\n * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn\'t exist, returns\n * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would\n * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the\n * `Snapshot.expire_time` field. If the name is not provided in the request, the server will\n * assign a random name for this snapshot on the same project as the subscription, conforming to\n * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The\n * generated name is populated in the returned Snapshot object. Note that for REST API requests,\n * you must specify a name in the request.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * String name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);\n * }\n * }</pre>\n *\n * @param name Required. User-provided name for this snapshot. If the name is not provided in the\n * request, the server will assign a random name for this snapshot on the same project as the\n * subscription. Note that for REST API requests, you must specify a name. See the <a\n * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name\n * rules</a>. Format is `projects/{project}/snapshots/{snap}`.\n * @param subscription Required. The subscription whose backlog the snapshot retains.\n * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the\n * subscription. More precisely, this is defined as the messages in the subscription\'s backlog\n * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as\n * well as: (b) Any messages published to the subscription\'s topic following the successful\n * completion of the CreateSnapshot request. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use Use {@link #createSnapshot(String, SubscriptionName)} instead.\n */\n @Deprecated\n public final Snapshot createSnapshot(String name, ProjectSubscriptionName subscription) {\n CreateSnapshotRequest request =\n CreateSnapshotRequest.newBuilder()\n .setName(name)\n .setSubscription(subscription == null ? null : subscription.toString())\n .build();\n return createSnapshot(request);\n }\n \n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Creates a snapshot from the requested subscription. Snapshots are used in\n * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to\n * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of\n * messages in an existing subscription to the state captured by a snapshot. If the snapshot\n * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn\'t exist, returns\n * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would\n * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the\n * `Snapshot.expire_time` field. If the name is not provided in the request, the server will\n * assign a random name for this snapshot on the same project as the subscription, conforming to\n * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The\n * generated name is populated in the returned Snapshot object. Note that for REST API requests,\n * you must specify a name in the request.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * String subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();\n * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);\n * }\n * }</pre>\n *\n * @param name Required. User-provided name for this snapshot. If the name is not provided in the\n * request, the server will assign a random name for this snapshot on the same project as the\n * subscription. Note that for REST API requests, you must specify a name. See the <a\n * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name\n * rules</a>. Format is `projects/{project}/snapshots/{snap}`.\n * @param subscription Required. The subscription whose backlog the snapshot retains.\n * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the\n * subscription. More precisely, this is defined as the messages in the subscription\'s backlog\n * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as\n * well as: (b) Any messages published to the subscription\'s topic following the successful\n * completion of the CreateSnapshot request. Format is\n * `projects/{project}/subscriptions/{sub}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use Use {@link #createSnapshot(SnapshotName, String)} instead.\n */\n @Deprecated\n public final Snapshot createSnapshot(ProjectSnapshotName name, String subscription) {\n CreateSnapshotRequest request =\n CreateSnapshotRequest.newBuilder()\n .setName(name == null ? null : name.toString())\n .setSubscription(subscription)\n .build();\n return createSnapshot(request);\n }\n'
DELETE_SNAPSHOT_PREVIOUS = '(\\s+public final void deleteSnapshot\\(DeleteSnapshotRequest request\\) {\\n\\s+deleteSnapshot.*\\n\\s+})'
DELETE_SNAPSHOT = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Removes an existing snapshot. Snapshots are used in [Seek]\n * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage\n * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in\n * an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all\n * messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new\n * one may be created with the same name, but the new one has no association with the old snapshot\n * or its subscription, unless the same subscription is specified.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * subscriptionAdminClient.deleteSnapshot(snapshot);\n * }\n * }</pre>\n *\n * @param snapshot Required. The name of the snapshot to delete. Format is\n * `projects/{project}/snapshots/{snap}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use Use {@link #deleteSnapshot(SnapshotName)} instead.\n */\n @Deprecated\n public final void deleteSnapshot(ProjectSnapshotName snapshot) {\n DeleteSnapshotRequest request =\n DeleteSnapshotRequest.newBuilder()\n .setSnapshot(snapshot == null ? null : snapshot.toString())\n .build();\n deleteSnapshot(request);\n }\n'
GET_SNAPSHOT_PREVIOUS = '(\\s+public final Snapshot getSnapshot\\(GetSnapshotRequest request\\) {\\n\\s+return.*\\n\\s+})'
GET_SNAPSHOT = '\n // AUTO-GENERATED DOCUMENTATION AND METHOD.\n /**\n * Gets the configuration details of a snapshot. Snapshots are used in <a\n * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which\n * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment\n * state of messages in an existing subscription to the state captured by a snapshot.\n *\n * <p>Sample code:\n *\n * <pre>{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);\n * }\n * }</pre>\n *\n * @param snapshot Required. The name of the snapshot to get. Format is\n * `projects/{project}/snapshots/{snap}`.\n * @throws com.google.api.gax.rpc.ApiException if the remote call fails\n * @deprecated Use Use {@link #getSnapshot(SnapshotName)} instead.\n */\n @Deprecated\n public final Snapshot getSnapshot(ProjectSnapshotName snapshot) {\n GetSnapshotRequest request =\n GetSnapshotRequest.newBuilder()\n .setSnapshot(snapshot == null ? null : snapshot.toString())\n .build();\n return getSnapshot(request);\n } \n'
PACKAGE = 'package com.google.cloud.pubsub.v1;'
IMPORT_PROJECT_TOPIC_NAME = 'import com.google.pubsub.v1.ProjectTopicName;'
IMPORT_PROJECT_SUBSCRIPTION_NAME = 'import com.google.pubsub.v1.ProjectSubscriptionName;'
IMPORT_PROJECT_SNAPSHOT_NAME = 'import com.google.pubsub.v1.ProjectSnapshotName;'
for library in s.get_staging_dirs():
# put any special-case replacements here
s.replace('**/stub/SubscriberStubSettings.java', 'setMaxInboundMessageSize\\(Integer.MAX_VALUE\\)', 'setMaxInboundMessageSize(20 << 20)')
s.replace('**/TopicAdminClient.java', GET_IAM_POLICY_PREVIOUS, '\\g<1>\n\n' + GET_IAM_POLICY_TOPIC)
s.replace('**/TopicAdminClient.java', SET_IAM_POLICY_PREVIOUS, '\\g<1>\n\n' + SET_IAM_POLICY_TOPIC)
s.replace('**/TopicAdminClient.java', TEST_IAM_PERMISSIONS_PREVIOUS, '\\g<1>\n\n' + TEST_IAM_PERMISSIONS_TOPIC)
s.replace('**/SubscriptionAdminClient.java', GET_IAM_POLICY_PREVIOUS, '\\g<1>\n\n' + GET_IAM_POLICY_SUBSCRIPTION)
s.replace('**/SubscriptionAdminClient.java', SET_IAM_POLICY_PREVIOUS, '\\g<1>\n\n' + SET_IAM_POLICY_SUBSCRIPTION)
s.replace('**/SubscriptionAdminClient.java', TEST_IAM_PERMISSIONS_PREVIOUS, '\\g<1>\n\n' + TEST_IAM_PERMISSIONS_SUBSCRIPTION)
s.replace('**/TopicAdminClient.java', CREATE_TOPIC_PREVIOUS, '\\g<1>\n\n' + CREATE_TOPIC)
s.replace('**/TopicAdminClient.java', DELETE_TOPIC_PREVIOUS, '\\g<1>\n\n' + DELETE_TOPIC)
s.replace('**/TopicAdminClient.java', LIST_TOPIC_SUBSCRIPTIONS_PREVIOUS, '\\g<1>\n\n' + LIST_TOPIC_SUBSCRIPTIONS)
s.replace('**/TopicAdminClient.java', GET_TOPIC_PREVIOUS, '\\g<1>\n\n' + GET_TOPIC)
s.replace('**/SubscriptionAdminClient.java', CREATE_SUBSCRIPTION_PREVIOUS, '\\g<1>\n\n' + CREATE_SUBSCRIPTION)
s.replace('**/SubscriptionAdminClient.java', DELETE_SUBSCRIPTION_PREVIOUS, '\\g<1>\n\n' + DELETE_SUBSCRIPTION)
s.replace('**/SubscriptionAdminClient.java', GET_SUBSCRIPTION_PREVIOUS, '\\g<1>\n\n' + GET_SUBSCRIPTION)
s.replace('**/SubscriptionAdminClient.java', MODIFY_ACK_DEADLINE_PREVIOUS, '\\g<1>\n\n' + MODIFY_ACK_DEADLINE)
s.replace('**/SubscriptionAdminClient.java', ACKNOWLEDGE_PREVIOUS, '\\g<1>\n\n' + ACKNOWLEDGE)
s.replace('**/SubscriptionAdminClient.java', PULL_PREVIOUS, '\\g<1>\n\n' + PULL)
s.replace('**/SubscriptionAdminClient.java', MODIFY_PUSH_CONFIG_PREVIOUS, '\\g<1>\n\n' + MODIFY_PUSH_CONFIG)
s.replace('**/SubscriptionAdminClient.java', CREATE_SNAPSHOT_PREVIOUS, '\\g<1>\n\n' + CREATE_SNAPSHOT)
s.replace('**/SubscriptionAdminClient.java', GET_SNAPSHOT_PREVIOUS, '\\g<1>\n\n' + GET_SNAPSHOT)
s.replace('**/SubscriptionAdminClient.java', DELETE_SNAPSHOT_PREVIOUS, '\\g<1>\n\n' + DELETE_SNAPSHOT)
s.replace('**/*AdminClient.java', PACKAGE, PACKAGE + '\n\n' + IMPORT_PROJECT_TOPIC_NAME + '\n' + IMPORT_PROJECT_SUBSCRIPTION_NAME + '\n' + IMPORT_PROJECT_SNAPSHOT_NAME + '\n')
s.move(library)
s.remove_staging_dirs()
java.common_templates(
monorepo=True,
excludes=[
".github/*",
".kokoro/*",
"samples/*",
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"SECURITY.md",
"java.header",
"license-checks.xml",
"renovate.json",
".gitignore"
])