From 8d69509962dbea0931019f586a2187688307b7f0 Mon Sep 17 00:00:00 2001 From: Sophia Yang <171981480+yangyzs@users.noreply.github.com> Date: Mon, 20 Jul 2026 13:25:30 -0400 Subject: [PATCH 1/3] chore: modernize post-processing for 13 libraries Remove legacy owlbot.py scripts and migrate configurations to librarian.yaml for the following libraries: - kms - logging - monitoring - monitoring-dashboards - network-management - os-login - pubsub - securitycenter - service-management - spanner - storage - tasks - vision For https://github.com/googleapis/librarian/issues/6931 TAG=agy CONV=bf7d8d16-0d5b-4778-9ed0-5601d1ebc219 --- java-kms/README.md | 15 +- java-kms/owlbot.py | 310 ----- java-logging/README.md | 14 +- java-logging/owlbot.py | 88 -- java-monitoring-dashboards/README.md | 15 +- java-monitoring-dashboards/owlbot.py | 41 - java-monitoring/README.md | 15 +- java-monitoring/owlbot.py | 57 - java-network-management/README.md | 15 +- java-network-management/owlbot.py | 199 --- java-os-login/README.md | 15 +- java-os-login/owlbot.py | 105 -- java-pubsub/README.md | 14 +- java-pubsub/owlbot.py | 102 -- java-securitycenter/README.md | 11 +- java-securitycenter/owlbot.py | 82 -- java-service-management/README.md | 15 +- java-service-management/owlbot.py | 59 - java-spanner/README.md | 14 +- java-spanner/owlbot.py | 36 - java-storage/README.md | 21 +- java-storage/owlbot.py | 41 - java-tasks/README.md | 15 +- java-tasks/owlbot.py | 77 -- java-vision/README.md | 15 +- java-vision/owlbot.py | 248 ---- librarian.yaml | 1869 +++++++++++++++++++++++++- 27 files changed, 1977 insertions(+), 1531 deletions(-) delete mode 100644 java-kms/owlbot.py delete mode 100644 java-logging/owlbot.py delete mode 100644 java-monitoring-dashboards/owlbot.py delete mode 100644 java-monitoring/owlbot.py delete mode 100644 java-network-management/owlbot.py delete mode 100644 java-os-login/owlbot.py delete mode 100644 java-pubsub/owlbot.py delete mode 100644 java-securitycenter/owlbot.py delete mode 100644 java-service-management/owlbot.py delete mode 100644 java-spanner/owlbot.py delete mode 100644 java-storage/owlbot.py delete mode 100644 java-tasks/owlbot.py delete mode 100644 java-vision/owlbot.py diff --git a/java-kms/README.md b/java-kms/README.md index 91a18a9770fe..8110bc739a8f 100644 --- a/java-kms/README.md +++ b/java-kms/README.md @@ -11,7 +11,6 @@ Java idiomatic client for [Cloud Key Management Service][product-docs]. ## Quickstart - If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: ```xml @@ -46,6 +45,14 @@ If you are using Maven without the BOM, add this to your dependencies: ``` +If you are using Gradle 5.x or later, add this to your dependencies: + +```Groovy +implementation platform('com.google.cloud:libraries-bom:26.83.0') + +implementation 'com.google.cloud:google-cloud-kms' +``` + If you are using Gradle without BOM, add this to your dependencies: ```Groovy @@ -71,7 +78,7 @@ The client application making API calls must be granted [authorization scopes][a ### Prerequisites You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Key Management Service [API enabled][enable-api]. - +You will need to [enable billing][enable-billing] to use Google Cloud Key Management Service. [Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by [installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line: `gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. @@ -147,8 +154,6 @@ the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` and on [google-cloud-java][g-c-j]. ## Versioning - - This library follows [Semantic Versioning](http://semver.org/). @@ -187,7 +192,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md [code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct [license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE - +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing [enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudkms.googleapis.com [libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png diff --git a/java-kms/owlbot.py b/java-kms/owlbot.py deleted file mode 100644 index fa3391e3090a..000000000000 --- a/java-kms/owlbot.py +++ /dev/null @@ -1,310 +0,0 @@ -# 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 -# -# 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 - -IMPLEMENTS_RESOURCE_NAME = "implements ResourceName" -EXTENDS_KEY_NAME = "extends KeyName" - -ENCRYPT_INSERTION_POINT = r'(\s+public final EncryptResponse encrypt\(ResourceName.*\) {\n.*\n.*\n.*\n.*\n.*\n.*return encrypt\(request\);\n\s+})' -SET_IAM_INSERTION_POINT = r'(\s+public final Policy setIamPolicy\(SetIamPolicyRequest request\) {\n\s+return.*\n\s+})' -GET_IAM_INSERTION_POINT = r'(\s+public final Policy getIamPolicy\(GetIamPolicyRequest request\) {\n\s+return.*\n\s+})' -TEST_IAM_INSERTION_POINT = r'(\s+public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) {\n\s+return.*\n\s+})' - -ENCRYPT_METHOD = """ - // ADDED BY SYNTH - /** - * Encrypts data, so that it can only be recovered by a call to - * [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The - * [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be - * [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. - * - *
Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * CryptoKeyPathName name = CryptoKeyName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
- * ByteString plaintext = ByteString.copyFromUtf8("");
- * EncryptResponse response = keyManagementServiceClient.encrypt(name, plaintext);
- * }
- *
- *
- * @param name Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] or
- * [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for encryption.
- * If a [CryptoKey][google.cloud.kms.v1.CryptoKey] is specified, the server will use its - * [primary version][google.cloud.kms.v1.CryptoKey.primary]. - * @param plaintext Required. The data to encrypt. Must be no larger than 64KiB. - *
The maximum size depends on the key version's - * [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - * [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] keys, the plaintext must be no - * larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined - * length of the plaintext and additional_authenticated_data fields must be no larger than - * 8KiB. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final EncryptResponse encrypt(CryptoKeyPathName name, ByteString plaintext) { - EncryptRequest request = - EncryptRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setPlaintext(plaintext) - .build(); - return encrypt(request); - } -""" - - -SET_IAM_METHODS = """ - // ADDED BY SYNTH - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - *
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED - * - *
Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * Policy policy = Policy.newBuilder().build();
- * Policy response = keyManagementServiceClient.setIamPolicy(resource, policy);
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy is being specified. See the
- * operation documentation for the appropriate value for this field.
- * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
- * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
- * Platform services (such as Projects) might reject them.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy setIamPolicy(KeyName resource, Policy policy) {
- SetIamPolicyRequest request =
- SetIamPolicyRequest.newBuilder()
- .setResource(resource == null ? null : resource.toString())
- .setPolicy(policy)
- .build();
- return setIamPolicy(request);
- }
-
- // ADDED BY SYNTH
- /**
- * Sets the access control policy on the specified resource. Replaces any existing policy.
- *
- * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED - * - *
Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * Policy policy = Policy.newBuilder().build();
- * Policy response = keyManagementServiceClient.setIamPolicy(resource.toString(), policy);
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy is being specified. See the
- * operation documentation for the appropriate value for this field.
- * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
- * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
- * Platform services (such as Projects) might reject them.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy setIamPolicy(String resource, Policy policy) {
- SetIamPolicyRequest request =
- SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build();
- return setIamPolicy(request);
- }
-"""
-
-GET_IAM_METHODS = """
- // ADDED BY SYNTH
- /**
- * Gets the access control policy for a resource. Returns an empty policy if the resource exists
- * and does not have a policy set.
- *
- * Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * Policy response = keyManagementServiceClient.getIamPolicy(resource);
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy is being requested. See the
- * operation documentation for the appropriate value for this field.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy getIamPolicy(KeyName resource) {
- GetIamPolicyRequest request =
- GetIamPolicyRequest.newBuilder()
- .setResource(resource == null ? null : resource.toString())
- .build();
- return getIamPolicy(request);
- }
-
- // ADDED BY SYNTH
- /**
- * Gets the access control policy for a resource. Returns an empty policy if the resource exists
- * and does not have a policy set.
- *
- * Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * Policy response = keyManagementServiceClient.getIamPolicy(resource.toString());
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy is being requested. See the
- * operation documentation for the appropriate value for this field.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy getIamPolicy(String resource) {
- GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build();
- return getIamPolicy(request);
- }
-"""
-
-TEST_IAM_METHODS = """
- // ADDED BY SYNTH
- /**
- * Returns permissions that a caller has on the specified resource. If the resource does not
- * exist, this will return an empty set of permissions, not a NOT_FOUND error.
- *
- * Note: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without - * warning. - * - *
Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * List<String> permissions = new ArrayList<>();
- * TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource, permissions);
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
- * operation documentation for the appropriate value for this field.
- * @param permissions The set of permissions to check for the `resource`. Permissions with
- * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
- * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final TestIamPermissionsResponse testIamPermissions(
- KeyName resource, ListNote: This operation is designed to be used for building permission-aware UIs and - * command-line tools, not for authorization checking. This operation may "fail open" without - * warning. - * - *
Sample code: - * - *
- * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
- * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
- * List<String> permissions = new ArrayList<>();
- * TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource.toString(), permissions);
- * }
- *
- *
- * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
- * operation documentation for the appropriate value for this field.
- * @param permissions The set of permissions to check for the `resource`. Permissions with
- * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
- * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final TestIamPermissionsResponse testIamPermissions(
- String resource, ListSample code:\n *\n *
\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy response = topicAdminClient.getIamPolicy(formattedResource);\n * }\n * \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 * Sample code:\n *\n *
\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");\n * Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);\n * }\n * \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 * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED\n *\n *
Sample code:\n *\n *
\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 * \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 * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED\n *\n *
Sample code:\n *\n *
\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 * \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 * 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 *
Sample code:\n *\n *
\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 * \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, ListNote: 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 *
Sample code:\n *\n *
\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 * \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, ListSample code:\n *\n *
\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * Topic response = topicAdminClient.createTopic(name);\n * }\n * \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 * Sample code:\n *\n *
\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * topicAdminClient.deleteTopic(topic);\n * }\n * \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 * Sample code:\n *\n *
\n * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {\n * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");\n * Topic response = topicAdminClient.getTopic(topic);\n * }\n * \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 * Sample code:\n *\n *
\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 * \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 * 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 *
Sample code:\n *\n *
\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 * \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 * 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 *
For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n *
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 *
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 *
Sample code:\n *\n *
{@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 * }\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 * 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 *
For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n *
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 *
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 *
Sample code:\n *\n *
{@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 * }\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 * 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 *
For push delivery, this value is also used to set the request timeout for the call to\n * the push endpoint.\n *
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 *
Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * Subscription response = subscriptionAdminClient.getSubscription(subscription);\n * }\n * }\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 * Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * subscriptionAdminClient.deleteSubscription(subscription);\n * }\n * }\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 * Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * List ackIds = new ArrayList<>();\n * int ackDeadlineSeconds = 2135351438;\n * subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);\n * }\n * } \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, ListAcknowledging 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 *
Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");\n * List ackIds = new ArrayList<>();\n * subscriptionAdminClient.acknowledge(subscription, ackIds);\n * }\n * } \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, ListSample code:\n *\n *
{@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 * }\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 * Sample code:\n *\n *
{@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 * }\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 * 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 *
Sample code:\n *\n *
{@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 * }\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 * 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 *
Sample code:\n *\n *
{@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 * }\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 * Sample code:\n *\n *
{@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 * }\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 * Sample code:\n *\n *
{@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 * }\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 * Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * subscriptionAdminClient.deleteSnapshot(snapshot);\n * }\n * }\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 * Sample code:\n *\n *
{@code\n * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {\n * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");\n * Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);\n * }\n * }\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"
-])
diff --git a/java-securitycenter/README.md b/java-securitycenter/README.md
index 538ef7e86577..e6fffdbaa7ce 100644
--- a/java-securitycenter/README.md
+++ b/java-securitycenter/README.md
@@ -11,7 +11,6 @@ Java idiomatic client for [Security Command Center][product-docs].
## Quickstart
-
If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
```xml
@@ -46,6 +45,14 @@ If you are using Maven without the BOM, add this to your dependencies:
```
+If you are using Gradle 5.x or later, add this to your dependencies:
+
+```Groovy
+implementation platform('com.google.cloud:libraries-bom:26.83.0')
+
+implementation 'com.google.cloud:google-cloud-securitycenter'
+```
+
If you are using Gradle without BOM, add this to your dependencies:
```Groovy
@@ -147,8 +154,6 @@ the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME`
and on [google-cloud-java][g-c-j].
## Versioning
-
-
This library follows [Semantic Versioning](http://semver.org/).
diff --git a/java-securitycenter/owlbot.py b/java-securitycenter/owlbot.py
deleted file mode 100644
index 8cb9f4e18b89..000000000000
--- a/java-securitycenter/owlbot.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# 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
-#
-# 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
-
-
-for library in s.get_staging_dirs():
- # put any special-case replacements here
- # TODO: remove for next major release (2.0.0)
- version = library.parts[len(library.parts) - 1]
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "formatOrganizationAssetName\(",
- "formatOrganizationAssetSecurityMarksName("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "formatOrganizationSourceFindingName\(",
- "formatOrganizationSourceFindingSecurityMarksName("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "newOrganizationAssetBuilder\(",
- "newOrganizationAssetSecurityMarksBuilder("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "newOrganizationSourceFindingBuilder\(",
- "newOrganizationSourceFindingSecurityMarksBuilder("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "ofOrganizationAssetName\(",
- "ofOrganizationAssetSecurityMarksName("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "ofOrganizationSourceFindingName\(",
- "ofOrganizationSourceFindingSecurityMarksName("
- )
- s.replace(
- [f"owl-bot-staging/{version}/proto-google-cloud-securitycenter-{version}/src/main/java/com/google/cloud/securitycenter/{version}/SecurityMarksName.java"],
- "OrganizationSourceFindingBuilder",
- "OrganizationSourceFindingSecurityMarksBuilder",
- )
-
- s.replace(
- [f"owl-bot-staging/{version}/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/{version}/SecurityCenterClientTest.java"],
- "SecurityMarksName.ofOrganizationAssetName",
- "SecurityMarksName.ofOrganizationAssetSecurityMarksName"
- )
- 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"
-])
diff --git a/java-service-management/README.md b/java-service-management/README.md
index 3b628208e5da..cfacc124da38 100644
--- a/java-service-management/README.md
+++ b/java-service-management/README.md
@@ -11,7 +11,6 @@ Java idiomatic client for [Service Management API][product-docs].
## Quickstart
-
If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
```xml
@@ -46,6 +45,14 @@ If you are using Maven without the BOM, add this to your dependencies:
```
+If you are using Gradle 5.x or later, add this to your dependencies:
+
+```Groovy
+implementation platform('com.google.cloud:libraries-bom:26.83.0')
+
+implementation 'com.google.cloud:google-cloud-service-management'
+```
+
If you are using Gradle without BOM, add this to your dependencies:
```Groovy
@@ -71,7 +78,7 @@ The client application making API calls must be granted [authorization scopes][a
### Prerequisites
You will need a [Google Cloud Platform Console][developer-console] project with the Service Management API [API enabled][enable-api].
-
+You will need to [enable billing][enable-billing] to use Google Service Management API.
[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by
[installing the Google Cloud Command Line Interface][cloud-cli] and running the following commands in command line:
`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`.
@@ -147,8 +154,6 @@ the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME`
and on [google-cloud-java][g-c-j].
## Versioning
-
-
This library follows [Semantic Versioning](http://semver.org/).
@@ -187,7 +192,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
[contributing]: https://github.com/googleapis/google-cloud-java/blob/main/CONTRIBUTING.md
[code-of-conduct]: https://github.com/googleapis/google-cloud-java/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct
[license]: https://github.com/googleapis/google-cloud-java/blob/main/LICENSE
-
+[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing
[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=servicemanagement.googleapis.com
[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
diff --git a/java-service-management/owlbot.py b/java-service-management/owlbot.py
deleted file mode 100644
index 259d9f4177d5..000000000000
--- a/java-service-management/owlbot.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# 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
-#
-# 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
-
-file_name = "owl-bot-staging/v1/google-cloud-service-management/src/test/java/com/google/cloud/api/servicemanagement/v1/ServiceManagerClientHttpJsonTest.java"
-
-for library in s.get_staging_dirs():
- # put any special-case replacements here
- s.replace(
- file_name,
- r'^import org.junit.Test;',
- 'import org.junit.Ignore;\nimport org.junit.Test;'
- )
- s.replace(
- file_name,
- r"\s+@Test\n\s+public void setIamPolicyTest\(\) throws Exception.*",
- '@Ignore("See: https://github.com/googleapis/sdk-platform-java/issues/1839")\n@Test\npublic void setIamPolicyTest() throws Exception {'
- )
- s.replace(
- file_name,
- r'\s+@Test\n\s+public void getIamPolicyTest\(\) throws Exception.*',
- '@Ignore("See: https://github.com/googleapis/sdk-platform-java/issues/1839")\n@Test\npublic void getIamPolicyTest() throws Exception {'
- )
- s.replace(
- file_name,
- r'\s+@Test\n\s+public void testIamPermissionsTest\(\) throws Exception.*',
- '@Ignore("See: https://github.com/googleapis/sdk-platform-java/issues/1839")@Test\npublic void testIamPermissionsTest() throws Exception {'
- )
- 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"
-])
diff --git a/java-spanner/README.md b/java-spanner/README.md
index acd53c4b0f00..20b7c1dcc675 100644
--- a/java-spanner/README.md
+++ b/java-spanner/README.md
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *
Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = keyManagementServiceClient.setIamPolicy(resource, policy);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(KeyName resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder()
+ .setResource(resource == null ? null : resource.toString())
+ .setPolicy(policy)
+ .build();
+ return setIamPolicy(request);
+ }
+
+ // ADDED BY SYNTH
+ /**
+ * Sets the access control policy on the specified resource. Replaces any existing policy.
+ *
+ * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *
Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = keyManagementServiceClient.setIamPolicy(resource.toString(), policy);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy setIamPolicy(String resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build();
+ return setIamPolicy(request);
+ }
+ - path: google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java
+ pattern: |
+ (?s)(public final Policy getIamPolicy\(GetIamPolicyRequest request\) \{\s*return getIamPolicyCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // ADDED BY SYNTH
+ /**
+ * Gets the access control policy for a resource. Returns an empty policy if the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * Policy response = keyManagementServiceClient.getIamPolicy(resource);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(KeyName resource) {
+ GetIamPolicyRequest request =
+ GetIamPolicyRequest.newBuilder()
+ .setResource(resource == null ? null : resource.toString())
+ .build();
+ return getIamPolicy(request);
+ }
+
+ // ADDED BY SYNTH
+ /**
+ * Gets the access control policy for a resource. Returns an empty policy if the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * Policy response = keyManagementServiceClient.getIamPolicy(resource.toString());
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Policy getIamPolicy(String resource) {
+ GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build();
+ return getIamPolicy(request);
+ }
+ - path: google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java
+ pattern: |
+ (?s)(public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) \{\s*return testIamPermissionsCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // ADDED BY SYNTH
+ /**
+ * Returns permissions that a caller has on the specified resource. If the resource does not
+ * exist, this will return an empty set of permissions, not a NOT_FOUND error.
+ *
+ * Note: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * List<String> permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource, permissions);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(
+ KeyName resource, ListNote: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
+ * try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) {
+ * KeyName resource = KeyRingName.of("[PROJECT]", "[LOCATION]", "[KEY_RING]");
+ * List<String> permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response = keyManagementServiceClient.testIamPermissions(resource.toString(), permissions);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final TestIamPermissionsResponse testIamPermissions(
+ String resource, ListSample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
+ * Topic response = topicAdminClient.createTopic(name);
+ * }
+ *
+ *
+ * @param name Required. The name of the topic. It must have the format
+ * `"projects/{project}/topics/{topic}"`. `{topic}` must start with a letter, and contain only
+ * letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`),
+ * tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters in
+ * length, and it must not start with `"goog"`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #createTopic(TopicName)} instead.
+ */
+ @Deprecated
+ public final Topic createTopic(ProjectTopicName name) {
+ Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build();
+ return createTopic(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final Topic getTopic\(String topic\) \{\s*GetTopicRequest request = GetTopicRequest\.newBuilder\(\)\.setTopic\(topic\)\.build\(\);\s*return getTopic\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the configuration of a topic.
+ *
+ * Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
+ * Topic response = topicAdminClient.getTopic(topic);
+ * }
+ *
+ *
+ * @param topic Required. The name of the topic to get. Format is
+ * `projects/{project}/topics/{topic}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #getTopic(TopicName)} instead.
+ */
+ @Deprecated
+ public final Topic getTopic(ProjectTopicName topic) {
+ GetTopicRequest request =
+ GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();
+ return getTopic(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions\(String topic\) \{\s*ListTopicSubscriptionsRequest request =\s*ListTopicSubscriptionsRequest\.newBuilder\(\)\.setTopic\(topic\)\.build\(\);\s*return listTopicSubscriptions\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Lists the names of the subscriptions on this topic.
+ *
+ * Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
+ * for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ *
+ *
+ * @param topic Required. The name of the topic that subscriptions are attached to. Format is
+ * `projects/{project}/topics/{topic}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #listTopicSubscriptions(TopicName)} instead.
+ */
+ @Deprecated
+ public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(ProjectTopicName topic) {
+ ListTopicSubscriptionsRequest request =
+ ListTopicSubscriptionsRequest.newBuilder()
+ .setTopic(topic == null ? null : topic.toString())
+ .build();
+ return listTopicSubscriptions(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final void deleteTopic\(String topic\) \{\s*DeleteTopicRequest request = DeleteTopicRequest\.newBuilder\(\)\.setTopic\(topic\)\.build\(\);\s*deleteTopic\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * 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_`.
+ *
+ * Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
+ * topicAdminClient.deleteTopic(topic);
+ * }
+ *
+ *
+ * @param topic Required. Name of the topic to delete. Format is
+ * `projects/{project}/topics/{topic}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #deleteTopic(TopicName)} instead.
+ */
+ @Deprecated
+ public final void deleteTopic(ProjectTopicName topic) {
+ DeleteTopicRequest request =
+ DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();
+ deleteTopic(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final Policy setIamPolicy\(SetIamPolicyRequest request\) \{\s*return setIamPolicyCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Sets the access control policy on the specified resource. Replaces any existing policy.
+ *
+ * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *
Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = topicAdminClient.setIamPolicy(formattedResource, policy);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead.
+ */
+ @Deprecated
+ public final Policy setIamPolicy(String resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build();
+ return setIamPolicy(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final Policy getIamPolicy\(GetIamPolicyRequest request\) \{\s*return getIamPolicyCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the access control policy for a resource. Returns an empty policy if the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * Policy response = topicAdminClient.getIamPolicy(formattedResource);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead.
+ */
+ @Deprecated
+ public final Policy getIamPolicy(String resource) {
+ GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build();
+ return getIamPolicy(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/TopicAdminClient.java
+ pattern: |
+ (?s)(public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) \{\s*return testIamPermissionsCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns permissions that a caller has on the specified resource. If the resource does not
+ * exist, this will return an empty set of permissions, not a NOT_FOUND error.
+ *
+ * Note: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
+ * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * List<String> permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead.
+ */
+ @Deprecated
+ public final TestIamPermissionsResponse testIamPermissions(
+ String resource, ListIf 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, conforming to the [resource name + * format](https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is + * populated in the returned Subscription object. Note that for REST API requests, you must + * specify a name in the request. + * + *
Sample code: + * + *
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * int ackDeadlineSeconds = 0;
+ * Subscription response = subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ *
+ *
+ * @param name Required. The name of the subscription. It must have the format
+ * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a
+ * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores
+ * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3
+ * and 255 characters in length, and it must not start with `"goog"`.
+ * @param topic Required. The name of the topic from which this subscription is receiving
+ * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be
+ * `_deleted-topic_` if the topic has been deleted.
+ * @param pushConfig If push delivery is used with this subscription, this field is used to
+ * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack
+ * messages using API methods.
+ * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits
+ * for the subscriber to acknowledge receipt before resending the message. In the interval
+ * after the message is delivered and before it is acknowledged, it is considered to be
+ * <i>outstanding</i>. During that time period, the message will not be
+ * redelivered (on a best-effort basis).
+ * For pull subscriptions, 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` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *
For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *
If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} + * instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, + ProjectTopicName topic, + PushConfig pushConfig, + int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already + * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *
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, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in + * the returned Subscription object. Note that for REST API requests, you must specify a name in + * the request. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * int ackDeadlineSeconds = 2135351438;
+ * Subscription response =
+ * subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ * }
+ *
+ * @param name Required. The name of the subscription. It must have the format
+ * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a
+ * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores
+ * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3
+ * and 255 characters in length, and it must not start with `"goog"`.
+ * @param topic Required. The name of the topic from which this subscription is receiving
+ * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be
+ * `_deleted-topic_` if the topic has been deleted.
+ * @param pushConfig If push delivery is used with this subscription, this field is used to
+ * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack
+ * messages using API methods.
+ * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits
+ * for the subscriber to acknowledge receipt before resending the message. In the interval
+ * after the message is delivered and before it is acknowledged, it is considered to be
+ * <i>outstanding</i>. During that time period, the message will not be
+ * redelivered (on a best-effort basis).
+ * For pull subscriptions, 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` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *
For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *
If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @deprecated Use {@link #createSubscription(SubscriptionName, String, PushConfig, int)} instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a subscription to a given topic. See the [resource name rules] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). If the subscription already + * exists, returns `ALREADY_EXISTS`. If the corresponding topic doesn't exist, returns + * `NOT_FOUND`. + * + *
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, conforming to the [resource name format] + * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated name is populated in + * the returned Subscription object. Note that for REST API requests, you must specify a name in + * the request. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName name = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * int ackDeadlineSeconds = 2135351438;
+ * Subscription response =
+ * subscriptionAdminClient.createSubscription(name, topic, pushConfig, ackDeadlineSeconds);
+ * }
+ * }
+ *
+ * @param name Required. The name of the subscription. It must have the format
+ * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must start with a
+ * letter, and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`), underscores
+ * (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent signs (`%`). It must be between 3
+ * and 255 characters in length, and it must not start with `"goog"`.
+ * @param topic Required. The name of the topic from which this subscription is receiving
+ * messages. Format is `projects/{project}/topics/{topic}`. The value of this field will be
+ * `_deleted-topic_` if the topic has been deleted.
+ * @param pushConfig If push delivery is used with this subscription, this field is used to
+ * configure it. An empty `pushConfig` signifies that the subscriber will pull and ack
+ * messages using API methods.
+ * @param ackDeadlineSeconds The approximate amount of time (on a best-effort basis) Pub/Sub waits
+ * for the subscriber to acknowledge receipt before resending the message. In the interval
+ * after the message is delivered and before it is acknowledged, it is considered to be
+ * <i>outstanding</i>. During that time period, the message will not be
+ * redelivered (on a best-effort basis).
+ * For pull subscriptions, 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` if using non-streaming pull or send the `ack_id` in a + * `StreamingModifyAckDeadlineRequest` if using streaming pull. The minimum custom deadline + * you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds + * (10 minutes). If this parameter is 0, a default value of 10 seconds is used. + *
For push delivery, this value is also used to set the request timeout for the call to + * the push endpoint. + *
If the subscriber never acknowledges the message, the Pub/Sub system will eventually + * redeliver the message. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #createSubscription(SubscriptionName, TopicName, PushConfig, int)} + * instead. + */ + @Deprecated + public final Subscription createSubscription( + ProjectSubscriptionName name, + TopicName topic, + PushConfig pushConfig, + int ackDeadlineSeconds) { + Subscription request = + Subscription.newBuilder() + .setName(name == null ? null : name.toString()) + .setTopic(topic == null ? null : topic.toString()) + .setPushConfig(pushConfig) + .setAckDeadlineSeconds(ackDeadlineSeconds) + .build(); + return createSubscription(request); + } + - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java + pattern: | + (?s)(public final Subscription getSubscription\(GetSubscriptionRequest request\) \{\s*return getSubscriptionCallable\(\)\.call\(request\);\s*\}) + replacement: | + $1 + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a subscription. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * Subscription response = subscriptionAdminClient.getSubscription(subscription);
+ * }
+ * }
+ *
+ * @param subscription Required. The name of the subscription to get. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #getSubscription(SubscriptionName)} instead.
+ */
+ @Deprecated
+ public final Subscription getSubscription(ProjectSubscriptionName subscription) {
+ GetSubscriptionRequest request =
+ GetSubscriptionRequest.newBuilder()
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .build();
+ return getSubscription(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final void deleteSubscription\(DeleteSubscriptionRequest request\) \{\s*deleteSubscriptionCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Deletes an existing subscription. All messages retained 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.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * subscriptionAdminClient.deleteSubscription(subscription);
+ * }
+ * }
+ *
+ * @param subscription Required. The subscription to delete. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #deleteSubscription(SubscriptionName)} instead.
+ */
+ @Deprecated
+ public final void deleteSubscription(ProjectSubscriptionName subscription) {
+ DeleteSubscriptionRequest request =
+ DeleteSubscriptionRequest.newBuilder()
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .build();
+ deleteSubscription(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final void modifyAckDeadline\(ModifyAckDeadlineRequest request\) \{\s*modifyAckDeadlineCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * 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. Note that this does not modify the
+ * subscription-level `ackDeadlineSeconds` used for subsequent messages.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * List ackIds = new ArrayList<>();
+ * int ackDeadlineSeconds = 2135351438;
+ * subscriptionAdminClient.modifyAckDeadline(subscription, ackIds, ackDeadlineSeconds);
+ * }
+ * }
+ *
+ * @param subscription Required. The name of the subscription. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param ackIds Required. List of acknowledgment IDs.
+ * @param ackDeadlineSeconds Required. The new ack deadline with respect to the time this request
+ * was sent to the Pub/Sub system. For example, if the value is 10, the new ack deadline will
+ * expire 10 seconds after the `ModifyAckDeadline` call was made. Specifying zero might
+ * immediately make the message available for delivery to another subscriber client. This
+ * typically results in an increase in the rate of message redeliveries (that is, duplicates).
+ * The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is
+ * 600 seconds (10 minutes).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #modifyAckDeadline(SubscriptionName, ListAcknowledging 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. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * List ackIds = new ArrayList<>();
+ * subscriptionAdminClient.acknowledge(subscription, ackIds);
+ * }
+ * }
+ *
+ * @param subscription Required. The subscription whose message is being acknowledged. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param ackIds Required. The acknowledgment ID for the messages being acknowledged that was
+ * returned by the Pub/Sub system in the `Pull` response. Must not be empty.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #acknowledge(SubscriptionName, ListSample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * int maxMessages = 496131527;
+ * PullResponse response = subscriptionAdminClient.pull(subscription, maxMessages);
+ * }
+ * }
+ *
+ * @param subscription Required. The subscription from which messages should be pulled. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param maxMessages Required. The maximum number of messages to return for this request. Must be
+ * a positive integer. The Pub/Sub system may return fewer than the number specified.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #pull(SubscriptionName, int)} instead.
+ */
+ @Deprecated
+ public final PullResponse pull(ProjectSubscriptionName subscription, int maxMessages) {
+ PullRequest request =
+ PullRequest.newBuilder()
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .setMaxMessages(maxMessages)
+ .build();
+ return pull(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Pulls messages from the server. The server may return `UNAVAILABLE` if there are too many
+ * concurrent pull requests pending for the given subscription.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * boolean returnImmediately = true;
+ * int maxMessages = 496131527;
+ * PullResponse response =
+ * subscriptionAdminClient.pull(subscription, returnImmediately, maxMessages);
+ * }
+ * }
+ *
+ * @param subscription Required. The subscription from which messages should be pulled. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param returnImmediately Optional. If this field set to true, the system will respond
+ * immediately even if it there are no messages available to return in the `Pull` response.
+ * Otherwise, the system may wait (for a bounded amount of time) until at least one message is
+ * available, rather than returning no messages. Warning: setting this field to `true` is
+ * discouraged because it adversely impacts the performance of `Pull` operations. We recommend
+ * that users do not set this field.
+ * @param maxMessages Required. The maximum number of messages to return for this request. Must be
+ * a positive integer. The Pub/Sub system may return fewer than the number specified.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #pull(SubscriptionName, boolean, int)} instead.
+ */
+ @Deprecated
+ final PullResponse pull(
+ ProjectSubscriptionName subscription, boolean returnImmediately, int maxMessages) {
+ PullRequest request =
+ PullRequest.newBuilder()
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .setReturnImmediately(returnImmediately)
+ .setMaxMessages(maxMessages)
+ .build();
+ return pull(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final void modifyPushConfig\(ModifyPushConfigRequest request\) \{\s*modifyPushConfigCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Modifies the `PushConfig` for a specified subscription.
+ *
+ * This may be used to change a push subscription to a pull one (signified by an empty + * `PushConfig`) or vice versa, or change the endpoint URL and other attributes of a push + * subscription. Messages will accumulate for delivery continuously through the call regardless of + * changes to the `PushConfig`. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * PushConfig pushConfig = PushConfig.newBuilder().build();
+ * subscriptionAdminClient.modifyPushConfig(subscription, pushConfig);
+ * }
+ * }
+ *
+ * @param subscription Required. The name of the subscription. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @param pushConfig Required. The push configuration for future deliveries.
+ * An empty `pushConfig` indicates that the Pub/Sub system should stop pushing messages + * from the given subscription and allow messages to be pulled and acknowledged - effectively + * pausing the subscription if `Pull` or `StreamingPull` is not called. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + * @deprecated Use {@link #modifyPushConfig(SubscriptionName, PushConfig)} instead. + */ + @Deprecated + public final void modifyPushConfig(ProjectSubscriptionName subscription, PushConfig pushConfig) { + ModifyPushConfigRequest request = + ModifyPushConfigRequest.newBuilder() + .setSubscription(subscription == null ? null : subscription.toString()) + .setPushConfig(pushConfig) + .build(); + modifyPushConfig(request); + } + - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java + pattern: | + (?s)(public final Snapshot getSnapshot\(GetSnapshotRequest request\) \{\s*return getSnapshotCallable\(\)\.call\(request\);\s*\}) + replacement: | + $1 + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the configuration details of a snapshot. Snapshots are used in <a + * href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a> operations, which + * allow you to manage message acknowledgments in bulk. That is, you can set the acknowledgment + * state of messages in an existing subscription to the state captured by a snapshot. + * + *
Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ * Snapshot response = subscriptionAdminClient.getSnapshot(snapshot);
+ * }
+ * }
+ *
+ * @param snapshot Required. The name of the snapshot to get. Format is
+ * `projects/{project}/snapshots/{snap}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use Use {@link #getSnapshot(SnapshotName)} instead.
+ */
+ @Deprecated
+ public final Snapshot getSnapshot(ProjectSnapshotName snapshot) {
+ GetSnapshotRequest request =
+ GetSnapshotRequest.newBuilder()
+ .setSnapshot(snapshot == null ? null : snapshot.toString())
+ .build();
+ return getSnapshot(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final Snapshot createSnapshot\(CreateSnapshotRequest request\) \{\s*return createSnapshotCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a snapshot from the requested subscription. Snapshots are used in
+ * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to
+ * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of
+ * messages in an existing subscription to the state captured by a snapshot. If the snapshot
+ * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns
+ * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would
+ * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the
+ * `Snapshot.expire_time` field. If the name is not provided in the request, the server will
+ * assign a random name for this snapshot on the same project as the subscription, conforming to
+ * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The
+ * generated name is populated in the returned Snapshot object. Note that for REST API requests,
+ * you must specify a name in the request.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+ * }
+ * }
+ *
+ * @param name Required. User-provided name for this snapshot. If the name is not provided in the
+ * request, the server will assign a random name for this snapshot on the same project as the
+ * subscription. Note that for REST API requests, you must specify a name. See the <a
+ * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name
+ * rules</a>. Format is `projects/{project}/snapshots/{snap}`.
+ * @param subscription Required. The subscription whose backlog the snapshot retains.
+ * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the
+ * subscription. More precisely, this is defined as the messages in the subscription's backlog
+ * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as
+ * well as: (b) Any messages published to the subscription's topic following the successful
+ * completion of the CreateSnapshot request. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use Use {@link #createSnapshot(SnapshotName, SubscriptionName)} instead.
+ */
+ @Deprecated
+ public final Snapshot createSnapshot(
+ ProjectSnapshotName name, ProjectSubscriptionName subscription) {
+ CreateSnapshotRequest request =
+ CreateSnapshotRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .build();
+ return createSnapshot(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a snapshot from the requested subscription. Snapshots are used in
+ * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to
+ * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of
+ * messages in an existing subscription to the state captured by a snapshot. If the snapshot
+ * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns
+ * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would
+ * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the
+ * `Snapshot.expire_time` field. If the name is not provided in the request, the server will
+ * assign a random name for this snapshot on the same project as the subscription, conforming to
+ * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The
+ * generated name is populated in the returned Snapshot object. Note that for REST API requests,
+ * you must specify a name in the request.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * String name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
+ * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
+ * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+ * }
+ * }
+ *
+ * @param name Required. User-provided name for this snapshot. If the name is not provided in the
+ * request, the server will assign a random name for this snapshot on the same project as the
+ * subscription. Note that for REST API requests, you must specify a name. See the <a
+ * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name
+ * rules</a>. Format is `projects/{project}/snapshots/{snap}`.
+ * @param subscription Required. The subscription whose backlog the snapshot retains.
+ * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the
+ * subscription. More precisely, this is defined as the messages in the subscription's backlog
+ * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as
+ * well as: (b) Any messages published to the subscription's topic following the successful
+ * completion of the CreateSnapshot request. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use Use {@link #createSnapshot(String, SubscriptionName)} instead.
+ */
+ @Deprecated
+ public final Snapshot createSnapshot(String name, ProjectSubscriptionName subscription) {
+ CreateSnapshotRequest request =
+ CreateSnapshotRequest.newBuilder()
+ .setName(name)
+ .setSubscription(subscription == null ? null : subscription.toString())
+ .build();
+ return createSnapshot(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Creates a snapshot from the requested subscription. Snapshots are used in
+ * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to
+ * manage message acknowledgments in bulk. That is, you can set the acknowledgment state of
+ * messages in an existing subscription to the state captured by a snapshot. If the snapshot
+ * already exists, returns `ALREADY_EXISTS`. If the requested subscription doesn't exist, returns
+ * `NOT_FOUND`. If the backlog in the subscription is too old -- and the resulting snapshot would
+ * expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned. See also the
+ * `Snapshot.expire_time` field. If the name is not provided in the request, the server will
+ * assign a random name for this snapshot on the same project as the subscription, conforming to
+ * the [resource name format] (https://cloud.google.com/pubsub/docs/admin#resource_names). The
+ * generated name is populated in the returned Snapshot object. Note that for REST API requests,
+ * you must specify a name in the request.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSnapshotName name = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ * String subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
+ * Snapshot response = subscriptionAdminClient.createSnapshot(name, subscription);
+ * }
+ * }
+ *
+ * @param name Required. User-provided name for this snapshot. If the name is not provided in the
+ * request, the server will assign a random name for this snapshot on the same project as the
+ * subscription. Note that for REST API requests, you must specify a name. See the <a
+ * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name
+ * rules</a>. Format is `projects/{project}/snapshots/{snap}`.
+ * @param subscription Required. The subscription whose backlog the snapshot retains.
+ * Specifically, the created snapshot is guaranteed to retain: (a) The existing backlog on the
+ * subscription. More precisely, this is defined as the messages in the subscription's backlog
+ * that are unacknowledged upon the successful completion of the `CreateSnapshot` request; as
+ * well as: (b) Any messages published to the subscription's topic following the successful
+ * completion of the CreateSnapshot request. Format is
+ * `projects/{project}/subscriptions/{sub}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use Use {@link #createSnapshot(SnapshotName, String)} instead.
+ */
+ @Deprecated
+ public final Snapshot createSnapshot(ProjectSnapshotName name, String subscription) {
+ CreateSnapshotRequest request =
+ CreateSnapshotRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .setSubscription(subscription)
+ .build();
+ return createSnapshot(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final void deleteSnapshot\(DeleteSnapshotRequest request\) \{\s*deleteSnapshotCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Removes an existing snapshot. Snapshots are used in [Seek]
+ * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which allow you to manage
+ * message acknowledgments in bulk. That is, you can set the acknowledgment state of messages in
+ * an existing subscription to the state captured by a snapshot. When the snapshot is deleted, all
+ * messages retained in the snapshot are immediately dropped. After a snapshot is deleted, a new
+ * one may be created with the same name, but the new one has no association with the old snapshot
+ * or its subscription, unless the same subscription is specified.
+ *
+ * Sample code: + * + *
{@code
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * ProjectSnapshotName snapshot = ProjectSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
+ * subscriptionAdminClient.deleteSnapshot(snapshot);
+ * }
+ * }
+ *
+ * @param snapshot Required. The name of the snapshot to delete. Format is
+ * `projects/{project}/snapshots/{snap}`.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use Use {@link #deleteSnapshot(SnapshotName)} instead.
+ */
+ @Deprecated
+ public final void deleteSnapshot(ProjectSnapshotName snapshot) {
+ DeleteSnapshotRequest request =
+ DeleteSnapshotRequest.newBuilder()
+ .setSnapshot(snapshot == null ? null : snapshot.toString())
+ .build();
+ deleteSnapshot(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final Policy setIamPolicy\(SetIamPolicyRequest request\) \{\s*return setIamPolicyCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Sets the access control policy on the specified resource. Replaces any existing policy.
+ *
+ * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED + * + *
Sample code: + * + *
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * Policy policy = Policy.newBuilder().build();
+ * Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being specified. See the
+ * operation documentation for the appropriate value for this field.
+ * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the
+ * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud
+ * Platform services (such as Projects) might reject them.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #setIamPolicy(SetIamPolicyRequest)} instead.
+ */
+ @Deprecated
+ public final Policy setIamPolicy(String resource, Policy policy) {
+ SetIamPolicyRequest request =
+ SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build();
+ return setIamPolicy(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final Policy getIamPolicy\(GetIamPolicyRequest request\) \{\s*return getIamPolicyCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Gets the access control policy for a resource. Returns an empty policy if the resource exists
+ * and does not have a policy set.
+ *
+ * Sample code: + * + *
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #getIamPolicy(GetIamPolicyRequest)} instead.
+ */
+ @Deprecated
+ public final Policy getIamPolicy(String resource) {
+ GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build();
+ return getIamPolicy(request);
+ }
+ - path: google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SubscriptionAdminClient.java
+ pattern: |
+ (?s)(public final TestIamPermissionsResponse testIamPermissions\(TestIamPermissionsRequest request\) \{\s*return testIamPermissionsCallable\(\)\.call\(request\);\s*\})
+ replacement: |
+ $1
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD
+ /**
+ * Returns permissions that a caller has on the specified resource. If the resource does not
+ * exist, this will return an empty set of permissions, not a NOT_FOUND error.
+ *
+ * Note: This operation is designed to be used for building permission-aware UIs and + * command-line tools, not for authorization checking. This operation may "fail open" without + * warning. + * + *
Sample code: + * + *
+ * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
+ * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
+ * List<String> permissions = new ArrayList<>();
+ * TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);
+ * }
+ *
+ *
+ * @param resource REQUIRED: The resource for which the policy detail is being requested. See the
+ * operation documentation for the appropriate value for this field.
+ * @param permissions The set of permissions to check for the `resource`. Permissions with
+ * wildcards (such as '*' or 'storage.*') are not allowed. For more information see
+ * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ * @deprecated Use {@link #testIamPermissions(TestIamPermissionsRequest)} instead.
+ */
+ @Deprecated
+ public final TestIamPermissionsResponse testIamPermissions(
+ String resource, List