diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java deleted file mode 100644 index ddc98a2f0..000000000 --- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/SchemaServiceClient.java +++ /dev/null @@ -1,2046 +0,0 @@ -/* - * Copyright 2023 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. - */ - -package com.google.cloud.pubsub.v1; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.paging.AbstractFixedSizeCollection; -import com.google.api.gax.paging.AbstractPage; -import com.google.api.gax.paging.AbstractPagedListResponse; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.pubsub.v1.stub.SchemaServiceStub; -import com.google.cloud.pubsub.v1.stub.SchemaServiceStubSettings; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.Empty; -import com.google.pubsub.v1.CommitSchemaRequest; -import com.google.pubsub.v1.CreateSchemaRequest; -import com.google.pubsub.v1.DeleteSchemaRequest; -import com.google.pubsub.v1.DeleteSchemaRevisionRequest; -import com.google.pubsub.v1.GetSchemaRequest; -import com.google.pubsub.v1.ListSchemaRevisionsRequest; -import com.google.pubsub.v1.ListSchemaRevisionsResponse; -import com.google.pubsub.v1.ListSchemasRequest; -import com.google.pubsub.v1.ListSchemasResponse; -import com.google.pubsub.v1.ProjectName; -import com.google.pubsub.v1.RollbackSchemaRequest; -import com.google.pubsub.v1.Schema; -import com.google.pubsub.v1.SchemaName; -import com.google.pubsub.v1.ValidateMessageRequest; -import com.google.pubsub.v1.ValidateMessageResponse; -import com.google.pubsub.v1.ValidateSchemaRequest; -import com.google.pubsub.v1.ValidateSchemaResponse; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Service for doing schema-related operations. - * - *
This class provides the ability to make remote calls to the backing service through method - * calls that map to API methods. Sample code to get started: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ProjectName parent = ProjectName.of("[PROJECT]"); - * Schema schema = Schema.newBuilder().build(); - * String schemaId = "schemaId-697673060"; - * Schema response = schemaServiceClient.createSchema(parent, schema, schemaId); - * } - * }- * - *
Note: close() needs to be called on the SchemaServiceClient object to clean up resources such - * as threads. In the example above, try-with-resources is used, which automatically calls close(). - * - *
Method | - *Description | - *Method Variants | - *
---|---|---|
CreateSchema | - *Creates a schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
GetSchema | - *Gets a schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
ListSchemas | - *Lists schemas in a project. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
ListSchemaRevisions | - *Lists all schema revisions for the named schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
CommitSchema | - *Commits a new schema revision to an existing schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
RollbackSchema | - *Creates a new schema revision that is a copy of the provided revision_id. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
DeleteSchemaRevision | - *Deletes a specific schema revision. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
DeleteSchema | - *Deletes a schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
ValidateSchema | - *Validates a schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
ValidateMessage | - *Validates a message against a schema. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
SetIamPolicy | - *Sets the access control policy on the specified resource. Replacesany existing policy. - * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
GetIamPolicy | - *Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
TestIamPermissions | - *Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error. - * Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. |
- *
- * Request object method variants only take one parameter, a request object, which must be constructed before the call. - *
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. - *
|
- *
See the individual methods for example code. - * - *
Many parameters require resource names to be formatted in a particular way. To assist with - * these names, this class includes a format method for each type of name, and additionally a parse - * method to extract the individual identifiers contained within names that are returned. - * - *
This class can be customized by passing in a custom instance of SchemaServiceSettings to - * create(). For example: - * - *
To customize credentials: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * SchemaServiceSettings schemaServiceSettings = - * SchemaServiceSettings.newBuilder() - * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) - * .build(); - * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings); - * }- * - *
To customize the endpoint: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * SchemaServiceSettings schemaServiceSettings = - * SchemaServiceSettings.newBuilder().setEndpoint(myEndpoint).build(); - * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings); - * }- * - *
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over - * the wire: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * SchemaServiceSettings schemaServiceSettings = - * SchemaServiceSettings.newHttpJsonBuilder().build(); - * SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings); - * }- * - *
Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@Generated("by gapic-generator-java") -public class SchemaServiceClient implements BackgroundResource { - private final SchemaServiceSettings settings; - private final SchemaServiceStub stub; - - /** Constructs an instance of SchemaServiceClient with default settings. */ - public static final SchemaServiceClient create() throws IOException { - return create(SchemaServiceSettings.newBuilder().build()); - } - - /** - * Constructs an instance of SchemaServiceClient, using the given settings. The channels are - * created based on the settings passed in, or defaults for any settings that are not set. - */ - public static final SchemaServiceClient create(SchemaServiceSettings settings) - throws IOException { - return new SchemaServiceClient(settings); - } - - /** - * Constructs an instance of SchemaServiceClient, using the given stub for making calls. This is - * for advanced usage - prefer using create(SchemaServiceSettings). - */ - public static final SchemaServiceClient create(SchemaServiceStub stub) { - return new SchemaServiceClient(stub); - } - - /** - * Constructs an instance of SchemaServiceClient, using the given settings. This is protected so - * that it is easy to make a subclass, but otherwise, the static factory methods should be - * preferred. - */ - protected SchemaServiceClient(SchemaServiceSettings settings) throws IOException { - this.settings = settings; - this.stub = ((SchemaServiceStubSettings) settings.getStubSettings()).createStub(); - } - - protected SchemaServiceClient(SchemaServiceStub stub) { - this.settings = null; - this.stub = stub; - } - - public final SchemaServiceSettings getSettings() { - return settings; - } - - public SchemaServiceStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ProjectName parent = ProjectName.of("[PROJECT]"); - * Schema schema = Schema.newBuilder().build(); - * String schemaId = "schemaId-697673060"; - * Schema response = schemaServiceClient.createSchema(parent, schema, schemaId); - * } - * }- * - * @param parent Required. The name of the project in which to create the schema. Format is - * `projects/{project-id}`. - * @param schema Required. The schema object to create. - *
This schema's `name` parameter is ignored. The schema object returned by CreateSchema - * will have a `name` made using the given `parent` and `schema_id`. - * @param schemaId The ID to use for the schema, which will become the final component of the - * schema's resource name. - *
See https://cloud.google.com/pubsub/docs/admin#resource_names for resource name - * constraints. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema createSchema(ProjectName parent, Schema schema, String schemaId) { - CreateSchemaRequest request = - CreateSchemaRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setSchema(schema) - .setSchemaId(schemaId) - .build(); - return createSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String parent = ProjectName.of("[PROJECT]").toString(); - * Schema schema = Schema.newBuilder().build(); - * String schemaId = "schemaId-697673060"; - * Schema response = schemaServiceClient.createSchema(parent, schema, schemaId); - * } - * }- * - * @param parent Required. The name of the project in which to create the schema. Format is - * `projects/{project-id}`. - * @param schema Required. The schema object to create. - *
This schema's `name` parameter is ignored. The schema object returned by CreateSchema - * will have a `name` made using the given `parent` and `schema_id`. - * @param schemaId The ID to use for the schema, which will become the final component of the - * schema's resource name. - *
See https://cloud.google.com/pubsub/docs/admin#resource_names for resource name - * constraints. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema createSchema(String parent, Schema schema, String schemaId) { - CreateSchemaRequest request = - CreateSchemaRequest.newBuilder() - .setParent(parent) - .setSchema(schema) - .setSchemaId(schemaId) - .build(); - return createSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * CreateSchemaRequest request = - * CreateSchemaRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .setSchemaId("schemaId-697673060") - * .build(); - * Schema response = schemaServiceClient.createSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema createSchema(CreateSchemaRequest request) { - return createSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * CreateSchemaRequest request = - * CreateSchemaRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .setSchemaId("schemaId-697673060") - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.createSchemaCallable().futureCall(request); - * // Do something. - * Schema response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * Schema response = schemaServiceClient.getSchema(name); - * } - * }- * - * @param name Required. The name of the schema to get. Format is - * `projects/{project}/schemas/{schema}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema getSchema(SchemaName name) { - GetSchemaRequest request = - GetSchemaRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return getSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * Schema response = schemaServiceClient.getSchema(name); - * } - * }- * - * @param name Required. The name of the schema to get. Format is - * `projects/{project}/schemas/{schema}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema getSchema(String name) { - GetSchemaRequest request = GetSchemaRequest.newBuilder().setName(name).build(); - return getSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * GetSchemaRequest request = - * GetSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setView(SchemaView.forNumber(0)) - * .build(); - * Schema response = schemaServiceClient.getSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema getSchema(GetSchemaRequest request) { - return getSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * GetSchemaRequest request = - * GetSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setView(SchemaView.forNumber(0)) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.getSchemaCallable().futureCall(request); - * // Do something. - * Schema response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ProjectName parent = ProjectName.of("[PROJECT]"); - * for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param parent Required. The name of the project in which to list schemas. Format is - * `projects/{project-id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemasPagedResponse listSchemas(ProjectName parent) { - ListSchemasRequest request = - ListSchemasRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .build(); - return listSchemas(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists schemas in a project. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String parent = ProjectName.of("[PROJECT]").toString(); - * for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param parent Required. The name of the project in which to list schemas. Format is - * `projects/{project-id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemasPagedResponse listSchemas(String parent) { - ListSchemasRequest request = ListSchemasRequest.newBuilder().setParent(parent).build(); - return listSchemas(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists schemas in a project. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemasRequest request = - * ListSchemasRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * for (Schema element : schemaServiceClient.listSchemas(request).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemasPagedResponse listSchemas(ListSchemasRequest request) { - return listSchemasPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists schemas in a project. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemasRequest request = - * ListSchemasRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.listSchemasPagedCallable().futureCall(request); - * // Do something. - * for (Schema element : future.get().iterateAll()) { - * // doThingsWith(element); - * } - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemasRequest request = - * ListSchemasRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * while (true) { - * ListSchemasResponse response = schemaServiceClient.listSchemasCallable().call(request); - * for (Schema element : response.getSchemasList()) { - * // doThingsWith(element); - * } - * String nextPageToken = response.getNextPageToken(); - * if (!Strings.isNullOrEmpty(nextPageToken)) { - * request = request.toBuilder().setPageToken(nextPageToken).build(); - * } else { - * break; - * } - * } - * } - * }- */ - public final UnaryCallable
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * for (Schema element : schemaServiceClient.listSchemaRevisions(name).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param name Required. The name of the schema to list revisions for. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemaRevisionsPagedResponse listSchemaRevisions(SchemaName name) { - ListSchemaRevisionsRequest request = - ListSchemaRevisionsRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - return listSchemaRevisions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists all schema revisions for the named schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * for (Schema element : schemaServiceClient.listSchemaRevisions(name).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param name Required. The name of the schema to list revisions for. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemaRevisionsPagedResponse listSchemaRevisions(String name) { - ListSchemaRevisionsRequest request = - ListSchemaRevisionsRequest.newBuilder().setName(name).build(); - return listSchemaRevisions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists all schema revisions for the named schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemaRevisionsRequest request = - * ListSchemaRevisionsRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * for (Schema element : schemaServiceClient.listSchemaRevisions(request).iterateAll()) { - * // doThingsWith(element); - * } - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListSchemaRevisionsPagedResponse listSchemaRevisions( - ListSchemaRevisionsRequest request) { - return listSchemaRevisionsPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists all schema revisions for the named schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemaRevisionsRequest request = - * ListSchemaRevisionsRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = - * schemaServiceClient.listSchemaRevisionsPagedCallable().futureCall(request); - * // Do something. - * for (Schema element : future.get().iterateAll()) { - * // doThingsWith(element); - * } - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ListSchemaRevisionsRequest request = - * ListSchemaRevisionsRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setView(SchemaView.forNumber(0)) - * .setPageSize(883849137) - * .setPageToken("pageToken873572522") - * .build(); - * while (true) { - * ListSchemaRevisionsResponse response = - * schemaServiceClient.listSchemaRevisionsCallable().call(request); - * for (Schema element : response.getSchemasList()) { - * // doThingsWith(element); - * } - * String nextPageToken = response.getNextPageToken(); - * if (!Strings.isNullOrEmpty(nextPageToken)) { - * request = request.toBuilder().setPageToken(nextPageToken).build(); - * } else { - * break; - * } - * } - * } - * }- */ - public final UnaryCallable
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * Schema schema = Schema.newBuilder().build(); - * Schema response = schemaServiceClient.commitSchema(name, schema); - * } - * }- * - * @param name Required. The name of the schema we are revising. Format is - * `projects/{project}/schemas/{schema}`. - * @param schema Required. The schema revision to commit. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema commitSchema(SchemaName name, Schema schema) { - CommitSchemaRequest request = - CommitSchemaRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setSchema(schema) - .build(); - return commitSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Commits a new schema revision to an existing schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * Schema schema = Schema.newBuilder().build(); - * Schema response = schemaServiceClient.commitSchema(name, schema); - * } - * }- * - * @param name Required. The name of the schema we are revising. Format is - * `projects/{project}/schemas/{schema}`. - * @param schema Required. The schema revision to commit. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema commitSchema(String name, Schema schema) { - CommitSchemaRequest request = - CommitSchemaRequest.newBuilder().setName(name).setSchema(schema).build(); - return commitSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Commits a new schema revision to an existing schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * CommitSchemaRequest request = - * CommitSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .build(); - * Schema response = schemaServiceClient.commitSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema commitSchema(CommitSchemaRequest request) { - return commitSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Commits a new schema revision to an existing schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * CommitSchemaRequest request = - * CommitSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.commitSchemaCallable().futureCall(request); - * // Do something. - * Schema response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * String revisionId = "revisionId-1507445162"; - * Schema response = schemaServiceClient.rollbackSchema(name, revisionId); - * } - * }- * - * @param name Required. The schema being rolled back with revision id. - * @param revisionId Required. The revision ID to roll back to. It must be a revision of the same - * schema. - *
Example: c7cfa2a8 - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema rollbackSchema(SchemaName name, String revisionId) { - RollbackSchemaRequest request = - RollbackSchemaRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setRevisionId(revisionId) - .build(); - return rollbackSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * String revisionId = "revisionId-1507445162"; - * Schema response = schemaServiceClient.rollbackSchema(name, revisionId); - * } - * }- * - * @param name Required. The schema being rolled back with revision id. - * @param revisionId Required. The revision ID to roll back to. It must be a revision of the same - * schema. - *
Example: c7cfa2a8 - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema rollbackSchema(String name, String revisionId) { - RollbackSchemaRequest request = - RollbackSchemaRequest.newBuilder().setName(name).setRevisionId(revisionId).build(); - return rollbackSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * RollbackSchemaRequest request = - * RollbackSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setRevisionId("revisionId-1507445162") - * .build(); - * Schema response = schemaServiceClient.rollbackSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema rollbackSchema(RollbackSchemaRequest request) { - return rollbackSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a new schema revision that is a copy of the provided revision_id. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * RollbackSchemaRequest request = - * RollbackSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setRevisionId("revisionId-1507445162") - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.rollbackSchemaCallable().futureCall(request); - * // Do something. - * Schema response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * String revisionId = "revisionId-1507445162"; - * Schema response = schemaServiceClient.deleteSchemaRevision(name, revisionId); - * } - * }- * - * @param name Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - *
Example: `projects/123/schemas/my-schema{@literal @}c7cfa2a8` - * @param revisionId Optional. This field is deprecated and should not be used for specifying the - * revision ID. The revision ID should be specified via the `name` parameter. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema deleteSchemaRevision(SchemaName name, String revisionId) { - DeleteSchemaRevisionRequest request = - DeleteSchemaRevisionRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setRevisionId(revisionId) - .build(); - return deleteSchemaRevision(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a specific schema revision. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * String revisionId = "revisionId-1507445162"; - * Schema response = schemaServiceClient.deleteSchemaRevision(name, revisionId); - * } - * }- * - * @param name Required. The name of the schema revision to be deleted, with a revision ID - * explicitly included. - *
Example: `projects/123/schemas/my-schema{@literal @}c7cfa2a8` - * @param revisionId Optional. This field is deprecated and should not be used for specifying the - * revision ID. The revision ID should be specified via the `name` parameter. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema deleteSchemaRevision(String name, String revisionId) { - DeleteSchemaRevisionRequest request = - DeleteSchemaRevisionRequest.newBuilder().setName(name).setRevisionId(revisionId).build(); - return deleteSchemaRevision(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a specific schema revision. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * DeleteSchemaRevisionRequest request = - * DeleteSchemaRevisionRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setRevisionId("revisionId-1507445162") - * .build(); - * Schema response = schemaServiceClient.deleteSchemaRevision(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Schema deleteSchemaRevision(DeleteSchemaRevisionRequest request) { - return deleteSchemaRevisionCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a specific schema revision. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * DeleteSchemaRevisionRequest request = - * DeleteSchemaRevisionRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setRevisionId("revisionId-1507445162") - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = - * schemaServiceClient.deleteSchemaRevisionCallable().futureCall(request); - * // Do something. - * Schema response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SchemaName name = SchemaName.of("[PROJECT]", "[SCHEMA]"); - * schemaServiceClient.deleteSchema(name); - * } - * }- * - * @param name Required. Name of the schema to delete. Format is - * `projects/{project}/schemas/{schema}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteSchema(SchemaName name) { - DeleteSchemaRequest request = - DeleteSchemaRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - deleteSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String name = SchemaName.of("[PROJECT]", "[SCHEMA]").toString(); - * schemaServiceClient.deleteSchema(name); - * } - * }- * - * @param name Required. Name of the schema to delete. Format is - * `projects/{project}/schemas/{schema}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteSchema(String name) { - DeleteSchemaRequest request = DeleteSchemaRequest.newBuilder().setName(name).build(); - deleteSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * DeleteSchemaRequest request = - * DeleteSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .build(); - * schemaServiceClient.deleteSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteSchema(DeleteSchemaRequest request) { - deleteSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * DeleteSchemaRequest request = - * DeleteSchemaRequest.newBuilder() - * .setName(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.deleteSchemaCallable().futureCall(request); - * // Do something. - * future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ProjectName parent = ProjectName.of("[PROJECT]"); - * Schema schema = Schema.newBuilder().build(); - * ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema); - * } - * }- * - * @param parent Required. The name of the project in which to validate schemas. Format is - * `projects/{project-id}`. - * @param schema Required. The schema object to validate. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema schema) { - ValidateSchemaRequest request = - ValidateSchemaRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setSchema(schema) - .build(); - return validateSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Validates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * String parent = ProjectName.of("[PROJECT]").toString(); - * Schema schema = Schema.newBuilder().build(); - * ValidateSchemaResponse response = schemaServiceClient.validateSchema(parent, schema); - * } - * }- * - * @param parent Required. The name of the project in which to validate schemas. Format is - * `projects/{project-id}`. - * @param schema Required. The schema object to validate. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ValidateSchemaResponse validateSchema(String parent, Schema schema) { - ValidateSchemaRequest request = - ValidateSchemaRequest.newBuilder().setParent(parent).setSchema(schema).build(); - return validateSchema(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Validates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ValidateSchemaRequest request = - * ValidateSchemaRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .build(); - * ValidateSchemaResponse response = schemaServiceClient.validateSchema(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request) { - return validateSchemaCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Validates a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ValidateSchemaRequest request = - * ValidateSchemaRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setSchema(Schema.newBuilder().build()) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = - * schemaServiceClient.validateSchemaCallable().futureCall(request); - * // Do something. - * ValidateSchemaResponse response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ValidateMessageRequest request = - * ValidateMessageRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setMessage(ByteString.EMPTY) - * .setEncoding(Encoding.forNumber(0)) - * .build(); - * ValidateMessageResponse response = schemaServiceClient.validateMessage(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ValidateMessageResponse validateMessage(ValidateMessageRequest request) { - return validateMessageCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Validates a message against a schema. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * ValidateMessageRequest request = - * ValidateMessageRequest.newBuilder() - * .setParent(ProjectName.of("[PROJECT]").toString()) - * .setMessage(ByteString.EMPTY) - * .setEncoding(Encoding.forNumber(0)) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = - * schemaServiceClient.validateMessageCallable().futureCall(request); - * // Do something. - * ValidateMessageResponse response = future.get(); - * } - * }
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SetIamPolicyRequest request = - * SetIamPolicyRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setPolicy(Policy.newBuilder().build()) - * .setUpdateMask(FieldMask.newBuilder().build()) - * .build(); - * Policy response = schemaServiceClient.setIamPolicy(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy setIamPolicy(SetIamPolicyRequest request) { - return setIamPolicyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sets the access control policy on the specified resource. Replacesany existing policy. - * - *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * SetIamPolicyRequest request = - * SetIamPolicyRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setPolicy(Policy.newBuilder().build()) - * .setUpdateMask(FieldMask.newBuilder().build()) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.setIamPolicyCallable().futureCall(request); - * // Do something. - * Policy response = future.get(); - * } - * }
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * GetIamPolicyRequest request = - * GetIamPolicyRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setOptions(GetPolicyOptions.newBuilder().build()) - * .build(); - * Policy response = schemaServiceClient.getIamPolicy(request); - * } - * }- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy getIamPolicy(GetIamPolicyRequest request) { - return getIamPolicyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets the access control policy for a resource. Returns an empty policyif the resource exists - * and does not have a policy set. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * GetIamPolicyRequest request = - * GetIamPolicyRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .setOptions(GetPolicyOptions.newBuilder().build()) - * .build(); - * ApiFuture- */ - public final UnaryCallablefuture = schemaServiceClient.getIamPolicyCallable().futureCall(request); - * // Do something. - * Policy response = future.get(); - * } - * }
Note: This operation is designed to be used for buildingpermission-aware UIs and - * command-line tools, not for authorizationchecking. This operation may "fail open" without - * warning. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * TestIamPermissionsRequest request = - * TestIamPermissionsRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .addAllPermissions(new ArrayList- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { - return testIamPermissionsCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Returns permissions that a caller has on the specified resource. If theresource does not exist, - * this will return an empty set ofpermissions, not a `NOT_FOUND` error. - * - *()) - * .build(); - * TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(request); - * } - * }
Note: This operation is designed to be used for buildingpermission-aware UIs and - * command-line tools, not for authorizationchecking. This operation may "fail open" without - * warning. - * - *
Sample code: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) { - * TestIamPermissionsRequest request = - * TestIamPermissionsRequest.newBuilder() - * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString()) - * .addAllPermissions(new ArrayList- */ - public final UnaryCallable()) - * .build(); - * ApiFuture future = - * schemaServiceClient.testIamPermissionsCallable().futureCall(request); - * // Do something. - * TestIamPermissionsResponse response = future.get(); - * } - * }
The default instance has everything set to sensible defaults: - * - *
The builder of this class is recursive, so contained classes are themselves builders. When - * build() is called, the tree of builders is called to create the complete settings object. - * - *
For example, to set the total timeout of createSchema to 30 seconds: - * - *
{@code - * // This snippet has been automatically generated and should be regarded as a code template only. - * // It will require modifications to work: - * // - It may require correct/in-range values for request initialization. - * // - It may require specifying regional endpoints when creating the service client as shown in - * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - * SchemaServiceSettings.Builder schemaServiceSettingsBuilder = SchemaServiceSettings.newBuilder(); - * schemaServiceSettingsBuilder - * .createSchemaSettings() - * .setRetrySettings( - * schemaServiceSettingsBuilder - * .createSchemaSettings() - * .getRetrySettings() - * .toBuilder() - * .setTotalTimeout(Duration.ofSeconds(30)) - * .build()); - * SchemaServiceSettings schemaServiceSettings = schemaServiceSettingsBuilder.build(); - * }- */ -@Generated("by gapic-generator-java") -public class SchemaServiceSettings extends ClientSettings
Note: This method does not support applying settings to streaming methods.
- */
- public Builder applyToAllUnaryMethods(
- ApiFunction This class provides the ability to make remote calls to the backing service through method
- * calls that map to API methods. Sample code to get started:
- *
- * Note: close() needs to be called on the SubscriptionAdminClient object to clean up resources
- * such as threads. In the example above, try-with-resources is used, which automatically calls
- * close().
- *
- * Creates a subscription to a given topic. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#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/pubsub-basics#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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Gets the configuration details of a subscription. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Updates an existing subscription. Note that certain properties of a subscription, such as its topic, are not modifiable. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Lists matching subscriptions. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages from the subscription.
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may be redelivered later. Acknowledging a message more than once will not result in an error. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Pulls messages from the server. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Establishes a stream with the server, which sends messages down to the client. The client streams acknowledgements and ack deadline modifications back to the server. The server will close the stream and return the status on any error. The server may close the stream with status `UNAVAILABLE` to reassign server-side resources, in which case, the client should re-establish the stream. Flow control can be achieved by configuring the underlying RPC channel. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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`. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Gets the configuration details of a 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Lists the existing snapshots. 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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/pubsub-basics#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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Updates 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided in the request. 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. Note that both the subscription and the snapshot must be on the same topic. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Sets the access control policy on the specified resource. Replacesany existing policy.
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.
- * Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. See the individual methods for example code.
- *
- * Many parameters require resource names to be formatted in a particular way. To assist with
- * these names, this class includes a format method for each type of name, and additionally a parse
- * method to extract the individual identifiers contained within names that are returned.
- *
- * This class can be customized by passing in a custom instance of SubscriptionAdminSettings to
- * create(). For example:
- *
- * To customize credentials:
- *
- * To customize the endpoint:
- *
- * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
- * the wire:
- *
- * Please refer to the GitHub repository's samples for more quickstart code snippets.
- */
-@Generated("by gapic-generator-java")
-public class SubscriptionAdminClient implements BackgroundResource {
- private final SubscriptionAdminSettings settings;
- private final SubscriberStub stub;
-
- /** Constructs an instance of SubscriptionAdminClient with default settings. */
- public static final SubscriptionAdminClient create() throws IOException {
- return create(SubscriptionAdminSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of SubscriptionAdminClient, using the given settings. The channels are
- * created based on the settings passed in, or defaults for any settings that are not set.
- */
- public static final SubscriptionAdminClient create(SubscriptionAdminSettings settings)
- throws IOException {
- return new SubscriptionAdminClient(settings);
- }
-
- /**
- * Constructs an instance of SubscriptionAdminClient, using the given stub for making calls. This
- * is for advanced usage - prefer using create(SubscriptionAdminSettings).
- */
- public static final SubscriptionAdminClient create(SubscriberStub stub) {
- return new SubscriptionAdminClient(stub);
- }
-
- /**
- * Constructs an instance of SubscriptionAdminClient, using the given settings. This is protected
- * so that it is easy to make a subclass, but otherwise, the static factory methods should be
- * preferred.
- */
- protected SubscriptionAdminClient(SubscriptionAdminSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((SubscriberStubSettings) settings.getStubSettings()).createStub();
- }
-
- protected SubscriptionAdminClient(SubscriberStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final SubscriptionAdminSettings getSettings() {
- return settings;
- }
-
- public SubscriberStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates a subscription to a given topic. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#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/pubsub-basics#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:
- *
- * 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
- */
- public final Subscription createSubscription(
- SubscriptionName 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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates a subscription to a given topic. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#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/pubsub-basics#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:
- *
- * 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
- */
- public final Subscription createSubscription(
- SubscriptionName 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/pubsub-basics#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/pubsub-basics#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:
- *
- * 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
- */
- public final Subscription createSubscription(
- String name, TopicName topic, PushConfig pushConfig, int ackDeadlineSeconds) {
- Subscription request =
- Subscription.newBuilder()
- .setName(name)
- .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/pubsub-basics#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/pubsub-basics#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:
- *
- * 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
- */
- public final Subscription createSubscription(
- String name, String topic, PushConfig pushConfig, int ackDeadlineSeconds) {
- Subscription request =
- Subscription.newBuilder()
- .setName(name)
- .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/pubsub-basics#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/pubsub-basics#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:
- *
- * 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:
- *
- * 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:
- *
- * 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:
- *
- * 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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates a subscription to a given topic. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#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/pubsub-basics#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:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may
- * be redelivered later. Acknowledging a message more than once will not result in an error.
- *
- * Sample code:
- *
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may
- * be redelivered later. Acknowledging a message more than once will not result in an error.
- *
- * Sample code:
- *
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may
- * be redelivered later. Acknowledging a message more than once will not result in an error.
- *
- * Sample code:
- *
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may
- * be redelivered later. Acknowledging a message more than once will not result in an error.
- *
- * Sample code:
- *
- * Acknowledging a message whose ack deadline has expired may succeed, but such a message may
- * be redelivered later. Acknowledging a message more than once will not result in an error.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * 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:
- *
- * 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
- */
- public final void modifyPushConfig(SubscriptionName subscription, PushConfig pushConfig) {
- ModifyPushConfigRequest request =
- ModifyPushConfigRequest.newBuilder()
- .setSubscription(subscription == null ? null : subscription.toString())
- .setPushConfig(pushConfig)
- .build();
- modifyPushConfig(request);
- }
-
- // 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:
- *
- * 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
- */
- public final void modifyPushConfig(String subscription, PushConfig pushConfig) {
- ModifyPushConfigRequest request =
- ModifyPushConfigRequest.newBuilder()
- .setSubscription(subscription)
- .setPushConfig(pushConfig)
- .build();
- modifyPushConfig(request);
- }
-
- // 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:
- *
- * 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:
- *
- * 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);
- }
-
- // 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:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
- *
- * Sample code:
- *
- * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
- *
- * Sample code:
- *
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Note: This operation is designed to be used for buildingpermission-aware UIs and
- * command-line tools, not for authorizationchecking. This operation may "fail open" without
- * warning.
- *
- * Sample code:
- *
- * 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:
- *
- * Note: This operation is designed to be used for buildingpermission-aware UIs and
- * command-line tools, not for authorizationchecking. This operation may "fail open" without
- * warning.
- *
- * Sample code:
- *
- * The default instance has everything set to sensible defaults:
- *
- * The builder of this class is recursive, so contained classes are themselves builders. When
- * build() is called, the tree of builders is called to create the complete settings object.
- *
- * For example, to set the total timeout of createSubscription to 30 seconds:
- *
- * Note: This method does not support applying settings to streaming methods.
- */
- public Builder applyToAllUnaryMethods(
- ApiFunction This class provides the ability to make remote calls to the backing service through method
- * calls that map to API methods. Sample code to get started:
- *
- * Note: close() needs to be called on the TopicAdminClient object to clean up resources such as
- * threads. In the example above, try-with-resources is used, which automatically calls close().
- *
- * Creates the given topic with the given name. See the [resource name rules] (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Updates an existing topic. Note that certain properties of a topic are not modifiable. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Gets the configuration of a topic. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Lists matching topics. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Lists the names of the attached subscriptions on this topic. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Lists the names of the snapshots on this topic. 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. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. 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_`. Request object method variants only take one parameter, a request object, which must be constructed before the call. "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Sets the access control policy on the specified resource. Replacesany existing policy.
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.
- * Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning. Request object method variants only take one parameter, a request object, which must be constructed before the call. Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service. See the individual methods for example code.
- *
- * Many parameters require resource names to be formatted in a particular way. To assist with
- * these names, this class includes a format method for each type of name, and additionally a parse
- * method to extract the individual identifiers contained within names that are returned.
- *
- * This class can be customized by passing in a custom instance of TopicAdminSettings to
- * create(). For example:
- *
- * To customize credentials:
- *
- * To customize the endpoint:
- *
- * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
- * the wire:
- *
- * Please refer to the GitHub repository's samples for more quickstart code snippets.
- */
-@Generated("by gapic-generator-java")
-public class TopicAdminClient implements BackgroundResource {
- private final TopicAdminSettings settings;
- private final PublisherStub stub;
-
- /** Constructs an instance of TopicAdminClient with default settings. */
- public static final TopicAdminClient create() throws IOException {
- return create(TopicAdminSettings.newBuilder().build());
- }
-
- /**
- * Constructs an instance of TopicAdminClient, using the given settings. The channels are created
- * based on the settings passed in, or defaults for any settings that are not set.
- */
- public static final TopicAdminClient create(TopicAdminSettings settings) throws IOException {
- return new TopicAdminClient(settings);
- }
-
- /**
- * Constructs an instance of TopicAdminClient, using the given stub for making calls. This is for
- * advanced usage - prefer using create(TopicAdminSettings).
- */
- public static final TopicAdminClient create(PublisherStub stub) {
- return new TopicAdminClient(stub);
- }
-
- /**
- * Constructs an instance of TopicAdminClient, using the given settings. This is protected so that
- * it is easy to make a subclass, but otherwise, the static factory methods should be preferred.
- */
- protected TopicAdminClient(TopicAdminSettings settings) throws IOException {
- this.settings = settings;
- this.stub = ((PublisherStubSettings) settings.getStubSettings()).createStub();
- }
-
- protected TopicAdminClient(PublisherStub stub) {
- this.settings = null;
- this.stub = stub;
- }
-
- public final TopicAdminSettings getSettings() {
- return settings;
- }
-
- public PublisherStub getStub() {
- return stub;
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates the given topic with the given name. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
- *
- * Sample code:
- *
- * Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED
- *
- * Sample code:
- *
- * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Sample code:
- *
- * Note: This operation is designed to be used for buildingpermission-aware UIs and
- * command-line tools, not for authorizationchecking. This operation may "fail open" without
- * warning.
- *
- * Sample code:
- *
- * 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:
- *
- * Note: This operation is designed to be used for buildingpermission-aware UIs and
- * command-line tools, not for authorizationchecking. This operation may "fail open" without
- * warning.
- *
- * Sample code:
- *
- * The default instance has everything set to sensible defaults:
- *
- * The builder of this class is recursive, so contained classes are themselves builders. When
- * build() is called, the tree of builders is called to create the complete settings object.
- *
- * For example, to set the total timeout of createTopic to 30 seconds:
- *
- * Note: This method does not support applying settings to streaming methods.
- */
- public Builder applyToAllUnaryMethods(
- ApiFunction The interfaces provided are listed below, along with usage samples.
- *
- * ======================= TopicAdminClient =======================
- *
- * Service Description: The service that an application uses to manipulate topics, and to send
- * messages to a topic.
- *
- * Sample for TopicAdminClient:
- *
- * ======================= SubscriptionAdminClient =======================
- *
- * Service Description: The service that an application uses to manipulate subscriptions and to
- * consume messages from a subscription via the `Pull` method or by establishing a bi-directional
- * stream using the `StreamingPull` method.
- *
- * Sample for SubscriptionAdminClient:
- *
- * ======================= SchemaServiceClient =======================
- *
- * Service Description: Service for doing schema-related operations.
- *
- * Sample for SchemaServiceClient:
- *
- * This class is for advanced usage.
- */
-@Generated("by gapic-generator-java")
-public class GrpcPublisherCallableFactory implements GrpcStubCallableFactory {
-
- @Override
- public {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName name = SubscriptionName.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);
- * }
- * }
- *
- *
- *
- *
- *
- *
- * Method
- * Description
- * Method Variants
- *
- *
- * CreateSubscription
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * GetSubscription
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * UpdateSubscription
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ListSubscriptions
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * DeleteSubscription
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ModifyAckDeadline
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * Acknowledge
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * Pull
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * StreamingPull
- *
- *
- *
- *
- *
- *
- *
- * ModifyPushConfig
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * GetSnapshot
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ListSnapshots
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * CreateSnapshot
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * UpdateSnapshot
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * DeleteSnapshot
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * Seek
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * SetIamPolicy
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * GetIamPolicy
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * TestIamPermissions
- *
- *
- *
- *
- *
- *
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * SubscriptionAdminSettings subscriptionAdminSettings =
- * SubscriptionAdminSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * SubscriptionAdminClient subscriptionAdminClient =
- * SubscriptionAdminClient.create(subscriptionAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * SubscriptionAdminSettings subscriptionAdminSettings =
- * SubscriptionAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
- * SubscriptionAdminClient subscriptionAdminClient =
- * SubscriptionAdminClient.create(subscriptionAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * SubscriptionAdminSettings subscriptionAdminSettings =
- * SubscriptionAdminSettings.newHttpJsonBuilder().build();
- * SubscriptionAdminClient subscriptionAdminClient =
- * SubscriptionAdminClient.create(subscriptionAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName name = SubscriptionName.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.
- * @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
- * _outstanding_. During that time period, the message will not be redelivered (on a
- * best-effort basis).
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName name = SubscriptionName.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.
- * @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
- * _outstanding_. During that time period, the message will not be redelivered (on a
- * best-effort basis).
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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.
- * @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
- * _outstanding_. During that time period, the message will not be redelivered (on a
- * best-effort basis).
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String name = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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.
- * @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
- * _outstanding_. During that time period, the message will not be redelivered (on a
- * best-effort basis).
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * Subscription request =
- * Subscription.newBuilder()
- * .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPushConfig(PushConfig.newBuilder().build())
- * .setBigqueryConfig(BigQueryConfig.newBuilder().build())
- * .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
- * .setAckDeadlineSeconds(2135351438)
- * .setRetainAckedMessages(true)
- * .setMessageRetentionDuration(Duration.newBuilder().build())
- * .putAllLabels(new HashMap
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Subscription createSubscription(Subscription request) {
- return createSubscriptionCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates a subscription to a given topic. See the <a
- * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name
- * rules</a>. If the subscription already exists, returns `ALREADY_EXISTS`. If the
- * corresponding topic doesn't exist, returns `NOT_FOUND`.
- *
- *
- *
- * @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).
- *
- * 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);
- * }
- *
{@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).
- * {@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).
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * Subscription request =
- * Subscription.newBuilder()
- * .setName(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPushConfig(PushConfig.newBuilder().build())
- * .setBigqueryConfig(BigQueryConfig.newBuilder().build())
- * .setCloudStorageConfig(CloudStorageConfig.newBuilder().build())
- * .setAckDeadlineSeconds(2135351438)
- * .setRetainAckedMessages(true)
- * .setMessageRetentionDuration(Duration.newBuilder().build())
- * .putAllLabels(new HashMap
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.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
- */
- public final Subscription getSubscription(SubscriptionName subscription) {
- GetSubscriptionRequest request =
- GetSubscriptionRequest.newBuilder()
- .setSubscription(subscription == null ? null : subscription.toString())
- .build();
- return getSubscription(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a subscription.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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
- */
- public final Subscription getSubscription(String subscription) {
- GetSubscriptionRequest request =
- GetSubscriptionRequest.newBuilder().setSubscription(subscription).build();
- return getSubscription(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a subscription.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetSubscriptionRequest request =
- * GetSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * Subscription response = subscriptionAdminClient.getSubscription(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Subscription getSubscription(GetSubscriptionRequest request) {
- return getSubscriptionCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a subscription.
- *
- * {@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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a subscription.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetSubscriptionRequest request =
- * GetSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * Subscription subscription = Subscription.newBuilder().build();
- * FieldMask updateMask = FieldMask.newBuilder().build();
- * Subscription response = subscriptionAdminClient.updateSubscription(subscription, updateMask);
- * }
- * }
- *
- * @param subscription Required. The updated subscription object.
- * @param updateMask Required. Indicates which fields in the provided subscription to update. Must
- * be specified and non-empty.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Subscription updateSubscription(Subscription subscription, FieldMask updateMask) {
- UpdateSubscriptionRequest request =
- UpdateSubscriptionRequest.newBuilder()
- .setSubscription(subscription)
- .setUpdateMask(updateMask)
- .build();
- return updateSubscription(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates an existing subscription. Note that certain properties of a subscription, such as its
- * topic, are not modifiable.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * UpdateSubscriptionRequest request =
- * UpdateSubscriptionRequest.newBuilder()
- * .setSubscription(Subscription.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * Subscription response = subscriptionAdminClient.updateSubscription(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Subscription updateSubscription(UpdateSubscriptionRequest request) {
- return updateSubscriptionCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates an existing subscription. Note that certain properties of a subscription, such as its
- * topic, are not modifiable.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * UpdateSubscriptionRequest request =
- * UpdateSubscriptionRequest.newBuilder()
- * .setSubscription(Subscription.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ProjectName project = ProjectName.of("[PROJECT]");
- * for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list subscriptions. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSubscriptionsPagedResponse listSubscriptions(ProjectName project) {
- ListSubscriptionsRequest request =
- ListSubscriptionsRequest.newBuilder()
- .setProject(project == null ? null : project.toString())
- .build();
- return listSubscriptions(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching subscriptions.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String project = ProjectName.of("[PROJECT]").toString();
- * for (Subscription element : subscriptionAdminClient.listSubscriptions(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list subscriptions. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSubscriptionsPagedResponse listSubscriptions(String project) {
- ListSubscriptionsRequest request =
- ListSubscriptionsRequest.newBuilder().setProject(project).build();
- return listSubscriptions(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching subscriptions.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSubscriptionsRequest request =
- * ListSubscriptionsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * for (Subscription element : subscriptionAdminClient.listSubscriptions(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSubscriptionsPagedResponse listSubscriptions(ListSubscriptionsRequest request) {
- return listSubscriptionsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching subscriptions.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSubscriptionsRequest request =
- * ListSubscriptionsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSubscriptionsRequest request =
- * ListSubscriptionsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * while (true) {
- * ListSubscriptionsResponse response =
- * subscriptionAdminClient.listSubscriptionsCallable().call(request);
- * for (Subscription element : response.getSubscriptionsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- * }
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.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
- */
- public final void deleteSubscription(SubscriptionName subscription) {
- DeleteSubscriptionRequest request =
- DeleteSubscriptionRequest.newBuilder()
- .setSubscription(subscription == null ? null : subscription.toString())
- .build();
- deleteSubscription(request);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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
- */
- public final void deleteSubscription(String subscription) {
- DeleteSubscriptionRequest request =
- DeleteSubscriptionRequest.newBuilder().setSubscription(subscription).build();
- deleteSubscription(request);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * DeleteSubscriptionRequest request =
- * DeleteSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * subscriptionAdminClient.deleteSubscription(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteSubscription(DeleteSubscriptionRequest request) {
- deleteSubscriptionCallable().call(request);
- }
-
- // 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.
- *
- * {@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);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * DeleteSubscriptionRequest request =
- * DeleteSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- * List
- *
- * @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
- */
- public final void modifyAckDeadline(
- SubscriptionName subscription, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * List
- *
- * @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
- */
- public final void modifyAckDeadline(
- String subscription, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ModifyAckDeadlineRequest request =
- * ModifyAckDeadlineRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .addAllAckIds(new ArrayList
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void modifyAckDeadline(ModifyAckDeadlineRequest request) {
- modifyAckDeadlineCallable().call(request);
- }
-
- // 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.
- *
- * {@code
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- * List
- *
- * @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, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ModifyAckDeadlineRequest request =
- * ModifyAckDeadlineRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .addAllAckIds(new ArrayList
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- * List
- *
- * @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
- */
- public final void acknowledge(SubscriptionName subscription, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * List
- *
- * @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
- */
- public final void acknowledge(String subscription, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * AcknowledgeRequest request =
- * AcknowledgeRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .addAllAckIds(new ArrayList
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void acknowledge(AcknowledgeRequest request) {
- acknowledgeCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Acknowledges the messages associated with the `ack_ids` in the `AcknowledgeRequest`. The
- * Pub/Sub system can remove the relevant messages from the subscription.
- *
- * {@code
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ProjectSubscriptionName subscription = ProjectSubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]");
- * List
- *
- * @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, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * AcknowledgeRequest request =
- * AcknowledgeRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .addAllAckIds(new ArrayList
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.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
- */
- public final PullResponse pull(SubscriptionName 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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
- */
- public final PullResponse pull(String subscription, int maxMessages) {
- PullRequest request =
- PullRequest.newBuilder().setSubscription(subscription).setMaxMessages(maxMessages).build();
- return pull(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Pulls messages from the server.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.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
- */
- public final PullResponse pull(
- SubscriptionName subscription, boolean returnImmediately, int maxMessages) {
- PullRequest request =
- PullRequest.newBuilder()
- .setSubscription(subscription == null ? null : subscription.toString())
- .setReturnImmediately(returnImmediately)
- .setMaxMessages(maxMessages)
- .build();
- return pull(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Pulls messages from the server.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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
- */
- public final PullResponse pull(String subscription, boolean returnImmediately, int maxMessages) {
- PullRequest request =
- PullRequest.newBuilder()
- .setSubscription(subscription)
- .setReturnImmediately(returnImmediately)
- .setMaxMessages(maxMessages)
- .build();
- return pull(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Pulls messages from the server.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * PullRequest request =
- * PullRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setReturnImmediately(true)
- * .setMaxMessages(496131527)
- * .build();
- * PullResponse response = subscriptionAdminClient.pull(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final PullResponse pull(PullRequest request) {
- return pullCallable().call(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.
- *
- * {@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.
- *
- * {@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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Pulls messages from the server.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * PullRequest request =
- * PullRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setReturnImmediately(true)
- * .setMaxMessages(496131527)
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * BidiStream
- */
- public final BidiStreamingCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName subscription = SubscriptionName.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.
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String subscription = SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString();
- * 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.
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ModifyPushConfigRequest request =
- * ModifyPushConfigRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setPushConfig(PushConfig.newBuilder().build())
- * .build();
- * subscriptionAdminClient.modifyPushConfig(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void modifyPushConfig(ModifyPushConfigRequest request) {
- modifyPushConfigCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Modifies the `PushConfig` for a specified subscription.
- *
- * {@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.
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ModifyPushConfigRequest request =
- * ModifyPushConfigRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .setPushConfig(PushConfig.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SnapshotName snapshot = SnapshotName.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
- */
- public final Snapshot getSnapshot(SnapshotName snapshot) {
- GetSnapshotRequest request =
- GetSnapshotRequest.newBuilder()
- .setSnapshot(snapshot == null ? null : snapshot.toString())
- .build();
- return getSnapshot(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
- * 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
- */
- public final Snapshot getSnapshot(String snapshot) {
- GetSnapshotRequest request = GetSnapshotRequest.newBuilder().setSnapshot(snapshot).build();
- return getSnapshot(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetSnapshotRequest request =
- * GetSnapshotRequest.newBuilder()
- * .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .build();
- * Snapshot response = subscriptionAdminClient.getSnapshot(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Snapshot getSnapshot(GetSnapshotRequest request) {
- return getSnapshotCallable().call(request);
- }
-
- // 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.
- *
- * {@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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration details of a 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetSnapshotRequest request =
- * GetSnapshotRequest.newBuilder()
- * .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ProjectName project = ProjectName.of("[PROJECT]");
- * for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list snapshots. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSnapshotsPagedResponse listSnapshots(ProjectName project) {
- ListSnapshotsRequest request =
- ListSnapshotsRequest.newBuilder()
- .setProject(project == null ? null : project.toString())
- .build();
- return listSnapshots(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the existing snapshots. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String project = ProjectName.of("[PROJECT]").toString();
- * for (Snapshot element : subscriptionAdminClient.listSnapshots(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list snapshots. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSnapshotsPagedResponse listSnapshots(String project) {
- ListSnapshotsRequest request = ListSnapshotsRequest.newBuilder().setProject(project).build();
- return listSnapshots(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the existing snapshots. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSnapshotsRequest request =
- * ListSnapshotsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * for (Snapshot element : subscriptionAdminClient.listSnapshots(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListSnapshotsPagedResponse listSnapshots(ListSnapshotsRequest request) {
- return listSnapshotsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the existing snapshots. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSnapshotsRequest request =
- * ListSnapshotsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * ListSnapshotsRequest request =
- * ListSnapshotsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * while (true) {
- * ListSnapshotsResponse response =
- * subscriptionAdminClient.listSnapshotsCallable().call(request);
- * for (Snapshot element : response.getSnapshotsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- * }
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
- * SubscriptionName subscription = SubscriptionName.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 [resource
- * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). 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
- */
- public final Snapshot createSnapshot(SnapshotName name, SubscriptionName 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/pubsub-basics#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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SnapshotName name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]");
- * String subscription = SubscriptionName.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 [resource
- * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). 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
- */
- public final Snapshot createSnapshot(SnapshotName name, String subscription) {
- CreateSnapshotRequest request =
- CreateSnapshotRequest.newBuilder()
- .setName(name == null ? null : name.toString())
- .setSubscription(subscription)
- .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/pubsub-basics#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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
- * SubscriptionName subscription = SubscriptionName.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 [resource
- * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). 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
- */
- public final Snapshot createSnapshot(String name, SubscriptionName 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/pubsub-basics#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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String name = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
- * String subscription = SubscriptionName.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 [resource
- * name rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). 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
- */
- public final Snapshot createSnapshot(String name, String subscription) {
- CreateSnapshotRequest request =
- CreateSnapshotRequest.newBuilder().setName(name).setSubscription(subscription).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/pubsub-basics#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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * CreateSnapshotRequest request =
- * CreateSnapshotRequest.newBuilder()
- * .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .putAllLabels(new HashMap
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Snapshot createSnapshot(CreateSnapshotRequest request) {
- return createSnapshotCallable().call(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.
- *
- * {@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.
- *
- * {@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.
- *
- * {@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);
- }
-
- // 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/pubsub-basics#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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * CreateSnapshotRequest request =
- * CreateSnapshotRequest.newBuilder()
- * .setName(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .putAllLabels(new HashMap
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * Snapshot snapshot = Snapshot.newBuilder().build();
- * FieldMask updateMask = FieldMask.newBuilder().build();
- * Snapshot response = subscriptionAdminClient.updateSnapshot(snapshot, updateMask);
- * }
- * }
- *
- * @param snapshot Required. The updated snapshot object.
- * @param updateMask Required. Indicates which fields in the provided snapshot to update. Must be
- * specified and non-empty.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Snapshot updateSnapshot(Snapshot snapshot, FieldMask updateMask) {
- UpdateSnapshotRequest request =
- UpdateSnapshotRequest.newBuilder().setSnapshot(snapshot).setUpdateMask(updateMask).build();
- return updateSnapshot(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * UpdateSnapshotRequest request =
- * UpdateSnapshotRequest.newBuilder()
- * .setSnapshot(Snapshot.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * Snapshot response = subscriptionAdminClient.updateSnapshot(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Snapshot updateSnapshot(UpdateSnapshotRequest request) {
- return updateSnapshotCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * UpdateSnapshotRequest request =
- * UpdateSnapshotRequest.newBuilder()
- * .setSnapshot(Snapshot.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SnapshotName snapshot = SnapshotName.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
- */
- public final void deleteSnapshot(SnapshotName snapshot) {
- DeleteSnapshotRequest request =
- DeleteSnapshotRequest.newBuilder()
- .setSnapshot(snapshot == null ? null : snapshot.toString())
- .build();
- deleteSnapshot(request);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String snapshot = SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString();
- * 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
- */
- public final void deleteSnapshot(String snapshot) {
- DeleteSnapshotRequest request =
- DeleteSnapshotRequest.newBuilder().setSnapshot(snapshot).build();
- deleteSnapshot(request);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * DeleteSnapshotRequest request =
- * DeleteSnapshotRequest.newBuilder()
- * .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .build();
- * subscriptionAdminClient.deleteSnapshot(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteSnapshot(DeleteSnapshotRequest request) {
- deleteSnapshotCallable().call(request);
- }
-
- // 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.
- *
- * {@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);
- }
-
- // 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * DeleteSnapshotRequest request =
- * DeleteSnapshotRequest.newBuilder()
- * .setSnapshot(SnapshotName.of("[PROJECT]", "[SNAPSHOT]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SeekRequest request =
- * SeekRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * SeekResponse response = subscriptionAdminClient.seek(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final SeekResponse seek(SeekRequest request) {
- return seekCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Seeks an existing subscription to a point in time or to a given snapshot, whichever is provided
- * in the request. 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. Note that both the subscription
- * and the snapshot must be on the same topic.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SeekRequest request =
- * SeekRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SetIamPolicyRequest request =
- * SetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setPolicy(Policy.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * Policy response = subscriptionAdminClient.setIamPolicy(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy setIamPolicy(SetIamPolicyRequest request) {
- return setIamPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Sets the access control policy on the specified resource. Replaces any existing 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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Sets the access control policy on the specified resource. Replacesany existing policy.
- *
- *
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * Policy policy = Policy.newBuilder().build();
- * Policy response = subscriptionAdminClient.setIamPolicy(formattedResource, policy);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SetIamPolicyRequest request =
- * SetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setPolicy(Policy.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetIamPolicyRequest request =
- * GetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setOptions(GetPolicyOptions.newBuilder().build())
- * .build();
- * Policy response = subscriptionAdminClient.getIamPolicy(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy getIamPolicy(GetIamPolicyRequest request) {
- return getIamPolicyCallable().call(request);
- }
-
- // 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.
- *
- *
- *
- * @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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the access control policy for a resource. Returns an empty policyif the resource exists
- * and does not have a policy set.
- *
- *
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * Policy response = subscriptionAdminClient.getIamPolicy(formattedResource);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * GetIamPolicyRequest request =
- * GetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setOptions(GetPolicyOptions.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * TestIamPermissionsRequest request =
- * TestIamPermissionsRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .addAllPermissions(new ArrayList
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
- return testIamPermissionsCallable().call(request);
- }
-
- // 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.
- *
- *
- *
- * @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
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * List<String> permissions = new ArrayList<>();
- * TestIamPermissionsResponse response = subscriptionAdminClient.testIamPermissions(formattedResource, permissions);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * TestIamPermissionsRequest request =
- * TestIamPermissionsRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .addAllPermissions(new ArrayList
- */
- public final UnaryCallable
- *
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * SubscriptionAdminSettings.Builder subscriptionAdminSettingsBuilder =
- * SubscriptionAdminSettings.newBuilder();
- * subscriptionAdminSettingsBuilder
- * .createSubscriptionSettings()
- * .setRetrySettings(
- * subscriptionAdminSettingsBuilder
- * .createSubscriptionSettings()
- * .getRetrySettings()
- * .toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30))
- * .build());
- * SubscriptionAdminSettings subscriptionAdminSettings = subscriptionAdminSettingsBuilder.build();
- * }
- */
-@Generated("by gapic-generator-java")
-public class SubscriptionAdminSettings extends ClientSettings{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- * Topic response = topicAdminClient.createTopic(name);
- * }
- * }
- *
- *
- *
- *
- *
- *
- * Method
- * Description
- * Method Variants
- *
- *
- * CreateTopic
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * UpdateTopic
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * Publish
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * GetTopic
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ListTopics
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ListTopicSubscriptions
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * ListTopicSnapshots
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * DeleteTopic
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * DetachSubscription
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * SetIamPolicy
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * GetIamPolicy
- *
- *
- *
- *
- *
- *
- *
- *
- *
- * TestIamPermissions
- *
- *
- *
- *
- *
- *
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * TopicAdminSettings topicAdminSettings =
- * TopicAdminSettings.newBuilder()
- * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- * .build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * TopicAdminSettings topicAdminSettings =
- * TopicAdminSettings.newBuilder().setEndpoint(myEndpoint).build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * TopicAdminSettings topicAdminSettings = TopicAdminSettings.newHttpJsonBuilder().build();
- * TopicAdminClient topicAdminClient = TopicAdminClient.create(topicAdminSettings);
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName name = TopicName.ofProjectTopicName("[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
- */
- public final Topic createTopic(TopicName name) {
- Topic request = Topic.newBuilder().setName(name == null ? null : name.toString()).build();
- return createTopic(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates the given topic with the given name. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * 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
- */
- public final Topic createTopic(String name) {
- Topic request = Topic.newBuilder().setName(name).build();
- return createTopic(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Creates the given topic with the given name. See the <a
- * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource name
- * rules</a>.
- *
- *
- *
- * @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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates the given topic with the given name. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ProjectTopicName name = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
- * Topic response = topicAdminClient.createTopic(name);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * Topic request =
- * Topic.newBuilder()
- * .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .putAllLabels(new HashMap
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Topic createTopic(Topic request) {
- return createTopicCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Creates the given topic with the given name. See the [resource name rules]
- * (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * Topic request =
- * Topic.newBuilder()
- * .setName(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .putAllLabels(new HashMap
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * Topic topic = Topic.newBuilder().build();
- * FieldMask updateMask = FieldMask.newBuilder().build();
- * Topic response = topicAdminClient.updateTopic(topic, updateMask);
- * }
- * }
- *
- * @param topic Required. The updated topic object.
- * @param updateMask Required. Indicates which fields in the provided topic to update. Must be
- * specified and non-empty. Note that if `update_mask` contains "message_storage_policy" but
- * the `message_storage_policy` is not set in the `topic` provided above, then the updated
- * value is determined by the policy configured at the project or organization level.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Topic updateTopic(Topic topic, FieldMask updateMask) {
- UpdateTopicRequest request =
- UpdateTopicRequest.newBuilder().setTopic(topic).setUpdateMask(updateMask).build();
- return updateTopic(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates an existing topic. Note that certain properties of a topic are not modifiable.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * UpdateTopicRequest request =
- * UpdateTopicRequest.newBuilder()
- * .setTopic(Topic.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * Topic response = topicAdminClient.updateTopic(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Topic updateTopic(UpdateTopicRequest request) {
- return updateTopicCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Updates an existing topic. Note that certain properties of a topic are not modifiable.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * UpdateTopicRequest request =
- * UpdateTopicRequest.newBuilder()
- * .setTopic(Topic.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- * List
- *
- * @param topic Required. The messages in the request will be published on this topic. Format is
- * `projects/{project}/topics/{topic}`.
- * @param messages Required. The messages to publish.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final PublishResponse publish(TopicName topic, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * List
- *
- * @param topic Required. The messages in the request will be published on this topic. Format is
- * `projects/{project}/topics/{topic}`.
- * @param messages Required. The messages to publish.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final PublishResponse publish(String topic, List{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * PublishRequest request =
- * PublishRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .addAllMessages(new ArrayList
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final PublishResponse publish(PublishRequest request) {
- return publishCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic does not exist.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * PublishRequest request =
- * PublishRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .addAllMessages(new ArrayList
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName topic = TopicName.ofProjectTopicName("[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
- */
- public final Topic getTopic(TopicName topic) {
- GetTopicRequest request =
- GetTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();
- return getTopic(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration of a topic.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * 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
- */
- public final Topic getTopic(String topic) {
- GetTopicRequest request = GetTopicRequest.newBuilder().setTopic(topic).build();
- return getTopic(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Gets the configuration of a 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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration of a topic.
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
- * Topic response = topicAdminClient.getTopic(topic);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * GetTopicRequest request =
- * GetTopicRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .build();
- * Topic response = topicAdminClient.getTopic(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Topic getTopic(GetTopicRequest request) {
- return getTopicCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the configuration of a topic.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * GetTopicRequest request =
- * GetTopicRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ProjectName project = ProjectName.of("[PROJECT]");
- * for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list topics. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicsPagedResponse listTopics(ProjectName project) {
- ListTopicsRequest request =
- ListTopicsRequest.newBuilder()
- .setProject(project == null ? null : project.toString())
- .build();
- return listTopics(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching topics.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String project = ProjectName.of("[PROJECT]").toString();
- * for (Topic element : topicAdminClient.listTopics(project).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param project Required. The name of the project in which to list topics. Format is
- * `projects/{project-id}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicsPagedResponse listTopics(String project) {
- ListTopicsRequest request = ListTopicsRequest.newBuilder().setProject(project).build();
- return listTopics(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching topics.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicsRequest request =
- * ListTopicsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * for (Topic element : topicAdminClient.listTopics(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicsPagedResponse listTopics(ListTopicsRequest request) {
- return listTopicsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists matching topics.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicsRequest request =
- * ListTopicsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicsRequest request =
- * ListTopicsRequest.newBuilder()
- * .setProject(ProjectName.of("[PROJECT]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * while (true) {
- * ListTopicsResponse response = topicAdminClient.listTopicsCallable().call(request);
- * for (Topic element : response.getTopicsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- * }
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- * for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
- * // 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
- */
- public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(TopicName topic) {
- ListTopicSubscriptionsRequest request =
- ListTopicSubscriptionsRequest.newBuilder()
- .setTopic(topic == null ? null : topic.toString())
- .build();
- return listTopicSubscriptions(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the attached subscriptions on this topic.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * for (String element : topicAdminClient.listTopicSubscriptions(topic).iterateAll()) {
- * // 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
- */
- public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(String topic) {
- ListTopicSubscriptionsRequest request =
- ListTopicSubscriptionsRequest.newBuilder().setTopic(topic).build();
- return listTopicSubscriptions(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Lists the names of the subscriptions on this topic.
- *
- *
- *
- * @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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the attached subscriptions on this topic.
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
- * for (ProjectSubscriptionName element : topicAdminClient.listTopicSubscriptions(topic).iterateAllAsProjectSubscriptionName()) {
- * // doThingsWith(element);
- * }
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSubscriptionsRequest request =
- * ListTopicSubscriptionsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * for (String element : topicAdminClient.listTopicSubscriptions(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicSubscriptionsPagedResponse listTopicSubscriptions(
- ListTopicSubscriptionsRequest request) {
- return listTopicSubscriptionsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the attached subscriptions on this topic.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSubscriptionsRequest request =
- * ListTopicSubscriptionsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSubscriptionsRequest request =
- * ListTopicSubscriptionsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * while (true) {
- * ListTopicSubscriptionsResponse response =
- * topicAdminClient.listTopicSubscriptionsCallable().call(request);
- * for (String element : response.getSubscriptionsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- * }
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- * for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param topic Required. The name of the topic that snapshots are attached to. Format is
- * `projects/{project}/topics/{topic}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicSnapshotsPagedResponse listTopicSnapshots(TopicName topic) {
- ListTopicSnapshotsRequest request =
- ListTopicSnapshotsRequest.newBuilder()
- .setTopic(topic == null ? null : topic.toString())
- .build();
- return listTopicSnapshots(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the snapshots on this topic. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * for (String element : topicAdminClient.listTopicSnapshots(topic).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param topic Required. The name of the topic that snapshots are attached to. Format is
- * `projects/{project}/topics/{topic}`.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicSnapshotsPagedResponse listTopicSnapshots(String topic) {
- ListTopicSnapshotsRequest request =
- ListTopicSnapshotsRequest.newBuilder().setTopic(topic).build();
- return listTopicSnapshots(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the snapshots on this topic. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSnapshotsRequest request =
- * ListTopicSnapshotsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * for (String element : topicAdminClient.listTopicSnapshots(request).iterateAll()) {
- * // doThingsWith(element);
- * }
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final ListTopicSnapshotsPagedResponse listTopicSnapshots(
- ListTopicSnapshotsRequest request) {
- return listTopicSnapshotsPagedCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Lists the names of the snapshots on this topic. 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.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSnapshotsRequest request =
- * ListTopicSnapshotsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ListTopicSnapshotsRequest request =
- * ListTopicSnapshotsRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
- * .build();
- * while (true) {
- * ListTopicSnapshotsResponse response =
- * topicAdminClient.listTopicSnapshotsCallable().call(request);
- * for (String element : response.getSnapshotsList()) {
- * // doThingsWith(element);
- * }
- * String nextPageToken = response.getNextPageToken();
- * if (!Strings.isNullOrEmpty(nextPageToken)) {
- * request = request.toBuilder().setPageToken(nextPageToken).build();
- * } else {
- * break;
- * }
- * }
- * }
- * }
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName topic = TopicName.ofProjectTopicName("[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
- */
- public final void deleteTopic(TopicName topic) {
- DeleteTopicRequest request =
- DeleteTopicRequest.newBuilder().setTopic(topic == null ? null : topic.toString()).build();
- deleteTopic(request);
- }
-
- // 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_`.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String topic = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString();
- * 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
- */
- public final void deleteTopic(String topic) {
- DeleteTopicRequest request = DeleteTopicRequest.newBuilder().setTopic(topic).build();
- deleteTopic(request);
- }
-
- // 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_`.
- *
- *
- *
- * @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);
- }
-
- // 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_`.
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * ProjectTopicName topic = ProjectTopicName.of("[PROJECT]", "[TOPIC]");
- * topicAdminClient.deleteTopic(topic);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * DeleteTopicRequest request =
- * DeleteTopicRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .build();
- * topicAdminClient.deleteTopic(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final void deleteTopic(DeleteTopicRequest request) {
- deleteTopicCallable().call(request);
- }
-
- // 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_`.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * DeleteTopicRequest request =
- * DeleteTopicRequest.newBuilder()
- * .setTopic(TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * DetachSubscriptionRequest request =
- * DetachSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * DetachSubscriptionResponse response = topicAdminClient.detachSubscription(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final DetachSubscriptionResponse detachSubscription(DetachSubscriptionRequest request) {
- return detachSubscriptionCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Detaches a subscription from this topic. All messages retained in the subscription are dropped.
- * Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the
- * subscription is a push subscription, pushes to the endpoint will stop.
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * DetachSubscriptionRequest request =
- * DetachSubscriptionRequest.newBuilder()
- * .setSubscription(SubscriptionName.of("[PROJECT]", "[SUBSCRIPTION]").toString())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * SetIamPolicyRequest request =
- * SetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setPolicy(Policy.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * Policy response = topicAdminClient.setIamPolicy(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy setIamPolicy(SetIamPolicyRequest request) {
- return setIamPolicyCallable().call(request);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD
- /**
- * Sets the access control policy on the specified resource. Replaces any existing 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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Sets the access control policy on the specified resource. Replacesany existing policy.
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * Policy policy = Policy.newBuilder().build();
- * Policy response = topicAdminClient.setIamPolicy(formattedResource, policy);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * SetIamPolicyRequest request =
- * SetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setPolicy(Policy.newBuilder().build())
- * .setUpdateMask(FieldMask.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * GetIamPolicyRequest request =
- * GetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setOptions(GetPolicyOptions.newBuilder().build())
- * .build();
- * Policy response = topicAdminClient.getIamPolicy(request);
- * }
- * }
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final Policy getIamPolicy(GetIamPolicyRequest request) {
- return getIamPolicyCallable().call(request);
- }
-
- // 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.
- *
- *
- *
- * @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);
- }
-
- // AUTO-GENERATED DOCUMENTATION AND METHOD.
- /**
- * Gets the access control policy for a resource. Returns an empty policyif the resource exists
- * and does not have a policy set.
- *
- *
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * Policy response = topicAdminClient.getIamPolicy(formattedResource);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * GetIamPolicyRequest request =
- * GetIamPolicyRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .setOptions(GetPolicyOptions.newBuilder().build())
- * .build();
- * ApiFuture
- */
- public final UnaryCallable{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TestIamPermissionsRequest request =
- * TestIamPermissionsRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .addAllPermissions(new ArrayList
- *
- * @param request The request object containing all of the parameters for the API call.
- * @throws com.google.api.gax.rpc.ApiException if the remote call fails
- */
- public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
- return testIamPermissionsCallable().call(request);
- }
-
- // 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.
- *
- *
- *
- * @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
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * String formattedResource = ProjectTopicName.format("[PROJECT]", "[TOPIC]");
- * List<String> permissions = new ArrayList<>();
- * TestIamPermissionsResponse response = topicAdminClient.testIamPermissions(formattedResource, permissions);
- * }
- *
{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TestIamPermissionsRequest request =
- * TestIamPermissionsRequest.newBuilder()
- * .setResource(SchemaName.of("[PROJECT]", "[SCHEMA]").toString())
- * .addAllPermissions(new ArrayList
- */
- public final UnaryCallable
- *
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * TopicAdminSettings.Builder topicAdminSettingsBuilder = TopicAdminSettings.newBuilder();
- * topicAdminSettingsBuilder
- * .createTopicSettings()
- * .setRetrySettings(
- * topicAdminSettingsBuilder
- * .createTopicSettings()
- * .getRetrySettings()
- * .toBuilder()
- * .setTotalTimeout(Duration.ofSeconds(30))
- * .build());
- * TopicAdminSettings topicAdminSettings = topicAdminSettingsBuilder.build();
- * }
- */
-@Generated("by gapic-generator-java")
-public class TopicAdminSettings extends ClientSettings{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (TopicAdminClient topicAdminClient = TopicAdminClient.create()) {
- * TopicName name = TopicName.ofProjectTopicName("[PROJECT]", "[TOPIC]");
- * Topic response = topicAdminClient.createTopic(name);
- * }
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SubscriptionAdminClient subscriptionAdminClient = SubscriptionAdminClient.create()) {
- * SubscriptionName name = SubscriptionName.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);
- * }
- * }
- *
- * {@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (SchemaServiceClient schemaServiceClient = SchemaServiceClient.create()) {
- * ProjectName parent = ProjectName.of("[PROJECT]");
- * Schema schema = Schema.newBuilder().build();
- * String schemaId = "schemaId-697673060";
- * Schema response = schemaServiceClient.createSchema(parent, schema, schemaId);
- * }
- * }
- */
-@Generated("by gapic-generator-java")
-package com.google.cloud.pubsub.v1;
-
-import javax.annotation.Generated;
diff --git a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java b/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java
deleted file mode 100644
index 60af80164..000000000
--- a/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/stub/GrpcPublisherCallableFactory.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2023 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.
- */
-
-package com.google.cloud.pubsub.v1.stub;
-
-import com.google.api.gax.grpc.GrpcCallSettings;
-import com.google.api.gax.grpc.GrpcCallableFactory;
-import com.google.api.gax.grpc.GrpcStubCallableFactory;
-import com.google.api.gax.rpc.BatchingCallSettings;
-import com.google.api.gax.rpc.BidiStreamingCallable;
-import com.google.api.gax.rpc.ClientContext;
-import com.google.api.gax.rpc.ClientStreamingCallable;
-import com.google.api.gax.rpc.OperationCallSettings;
-import com.google.api.gax.rpc.OperationCallable;
-import com.google.api.gax.rpc.PagedCallSettings;
-import com.google.api.gax.rpc.ServerStreamingCallSettings;
-import com.google.api.gax.rpc.ServerStreamingCallable;
-import com.google.api.gax.rpc.StreamingCallSettings;
-import com.google.api.gax.rpc.UnaryCallSettings;
-import com.google.api.gax.rpc.UnaryCallable;
-import com.google.longrunning.Operation;
-import com.google.longrunning.stub.OperationsStub;
-import javax.annotation.Generated;
-
-// AUTO-GENERATED DOCUMENTATION AND CLASS.
-/**
- * gRPC callable factory implementation for the Publisher service API.
- *
- *