com.google.cloud.pubsub.v1.SchemaServiceClient Maven / Gradle / Ivy
Show all versions of google-cloud-pubsub Show documentation
/*
* Copyright 2024 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().
*
*
* Methods
*
* 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.
*
* createSchema(CreateSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createSchema(ProjectName parent, Schema schema, String schemaId)
*
createSchema(String parent, Schema schema, String schemaId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createSchemaCallable()
*
*
*
*
* GetSchema
* Gets a schema.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getSchema(GetSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getSchema(SchemaName name)
*
getSchema(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getSchemaCallable()
*
*
*
*
* ListSchemas
* Lists schemas in a project.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listSchemas(ListSchemasRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listSchemas(ProjectName parent)
*
listSchemas(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listSchemasPagedCallable()
*
listSchemasCallable()
*
*
*
*
* 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.
*
* listSchemaRevisions(ListSchemaRevisionsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listSchemaRevisions(SchemaName name)
*
listSchemaRevisions(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listSchemaRevisionsPagedCallable()
*
listSchemaRevisionsCallable()
*
*
*
*
* 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.
*
* commitSchema(CommitSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* commitSchema(SchemaName name, Schema schema)
*
commitSchema(String name, Schema schema)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* commitSchemaCallable()
*
*
*
*
* 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.
*
* rollbackSchema(RollbackSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* rollbackSchema(SchemaName name, String revisionId)
*
rollbackSchema(String name, String revisionId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* rollbackSchemaCallable()
*
*
*
*
* DeleteSchemaRevision
* Deletes a specific schema revision.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteSchemaRevision(DeleteSchemaRevisionRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deleteSchemaRevision(SchemaName name, String revisionId)
*
deleteSchemaRevision(String name, String revisionId)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteSchemaRevisionCallable()
*
*
*
*
* DeleteSchema
* Deletes a schema.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteSchema(DeleteSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deleteSchema(SchemaName name)
*
deleteSchema(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteSchemaCallable()
*
*
*
*
* ValidateSchema
* Validates a schema.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* validateSchema(ValidateSchemaRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* validateSchema(ProjectName parent, Schema schema)
*
validateSchema(String parent, Schema schema)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* validateSchemaCallable()
*
*
*
*
* 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.
*
* validateMessage(ValidateMessageRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* validateMessageCallable()
*
*
*
*
* 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.
*
* setIamPolicy(SetIamPolicyRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* setIamPolicyCallable()
*
*
*
*
* 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.
*
* getIamPolicy(GetIamPolicyRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getIamPolicyCallable()
*
*
*
*
* 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.
*
* testIamPermissions(TestIamPermissionsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* testIamPermissionsCallable()
*
*
*
*
*
* 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/pubsub-basics#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/pubsub-basics#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 future = schemaServiceClient.createSchemaCallable().futureCall(request);
* // Do something.
* Schema response = future.get();
* }
* }
*/
public final UnaryCallable createSchemaCallable() {
return stub.createSchemaCallable();
}
// 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()) {
* 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 future = schemaServiceClient.getSchemaCallable().futureCall(request);
* // Do something.
* Schema response = future.get();
* }
* }
*/
public final UnaryCallable getSchemaCallable() {
return stub.getSchemaCallable();
}
// 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()) {
* 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 future = schemaServiceClient.listSchemasPagedCallable().futureCall(request);
* // Do something.
* for (Schema element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listSchemasPagedCallable() {
return stub.listSchemasPagedCallable();
}
// 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();
* 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 listSchemasCallable() {
return stub.listSchemasCallable();
}
// 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()) {
* 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 future =
* schemaServiceClient.listSchemaRevisionsPagedCallable().futureCall(request);
* // Do something.
* for (Schema element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listSchemaRevisionsPagedCallable() {
return stub.listSchemaRevisionsPagedCallable();
}
// 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();
* 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
listSchemaRevisionsCallable() {
return stub.listSchemaRevisionsCallable();
}
// 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()) {
* 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 future = schemaServiceClient.commitSchemaCallable().futureCall(request);
* // Do something.
* Schema response = future.get();
* }
* }
*/
public final UnaryCallable commitSchemaCallable() {
return stub.commitSchemaCallable();
}
// 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()) {
* 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 future = schemaServiceClient.rollbackSchemaCallable().futureCall(request);
* // Do something.
* Schema response = future.get();
* }
* }
*/
public final UnaryCallable rollbackSchemaCallable() {
return stub.rollbackSchemaCallable();
}
// 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()) {
* 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 future =
* schemaServiceClient.deleteSchemaRevisionCallable().futureCall(request);
* // Do something.
* Schema response = future.get();
* }
* }
*/
public final UnaryCallable deleteSchemaRevisionCallable() {
return stub.deleteSchemaRevisionCallable();
}
// 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()) {
* 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 future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteSchemaCallable() {
return stub.deleteSchemaCallable();
}
// 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()) {
* 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 future =
* schemaServiceClient.validateSchemaCallable().futureCall(request);
* // Do something.
* ValidateSchemaResponse response = future.get();
* }
* }
*/
public final UnaryCallable
validateSchemaCallable() {
return stub.validateSchemaCallable();
}
// 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();
* 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 future =
* schemaServiceClient.validateMessageCallable().futureCall(request);
* // Do something.
* ValidateMessageResponse response = future.get();
* }
* }
*/
public final UnaryCallable
validateMessageCallable() {
return stub.validateMessageCallable();
}
// 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();
* 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 future = schemaServiceClient.setIamPolicyCallable().futureCall(request);
* // Do something.
* Policy response = future.get();
* }
* }
*/
public final UnaryCallable setIamPolicyCallable() {
return stub.setIamPolicyCallable();
}
// 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();
* 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 future = schemaServiceClient.getIamPolicyCallable().futureCall(request);
* // Do something.
* Policy response = future.get();
* }
* }
*/
public final UnaryCallable getIamPolicyCallable() {
return stub.getIamPolicyCallable();
}
// 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.
*
* 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())
* .build();
* TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(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 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.
*
* 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())
* .build();
* ApiFuture future =
* schemaServiceClient.testIamPermissionsCallable().futureCall(request);
* // Do something.
* TestIamPermissionsResponse response = future.get();
* }
* }
*/
public final UnaryCallable
testIamPermissionsCallable() {
return stub.testIamPermissionsCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListSchemasPagedResponse
extends AbstractPagedListResponse<
ListSchemasRequest,
ListSchemasResponse,
Schema,
ListSchemasPage,
ListSchemasFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListSchemasPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage, input -> new ListSchemasPagedResponse(input), MoreExecutors.directExecutor());
}
private ListSchemasPagedResponse(ListSchemasPage page) {
super(page, ListSchemasFixedSizeCollection.createEmptyCollection());
}
}
public static class ListSchemasPage
extends AbstractPage {
private ListSchemasPage(
PageContext context,
ListSchemasResponse response) {
super(context, response);
}
private static ListSchemasPage createEmptyPage() {
return new ListSchemasPage(null, null);
}
@Override
protected ListSchemasPage createPage(
PageContext context,
ListSchemasResponse response) {
return new ListSchemasPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListSchemasFixedSizeCollection
extends AbstractFixedSizeCollection<
ListSchemasRequest,
ListSchemasResponse,
Schema,
ListSchemasPage,
ListSchemasFixedSizeCollection> {
private ListSchemasFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListSchemasFixedSizeCollection createEmptyCollection() {
return new ListSchemasFixedSizeCollection(null, 0);
}
@Override
protected ListSchemasFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListSchemasFixedSizeCollection(pages, collectionSize);
}
}
public static class ListSchemaRevisionsPagedResponse
extends AbstractPagedListResponse<
ListSchemaRevisionsRequest,
ListSchemaRevisionsResponse,
Schema,
ListSchemaRevisionsPage,
ListSchemaRevisionsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListSchemaRevisionsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListSchemaRevisionsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListSchemaRevisionsPagedResponse(ListSchemaRevisionsPage page) {
super(page, ListSchemaRevisionsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListSchemaRevisionsPage
extends AbstractPage<
ListSchemaRevisionsRequest,
ListSchemaRevisionsResponse,
Schema,
ListSchemaRevisionsPage> {
private ListSchemaRevisionsPage(
PageContext context,
ListSchemaRevisionsResponse response) {
super(context, response);
}
private static ListSchemaRevisionsPage createEmptyPage() {
return new ListSchemaRevisionsPage(null, null);
}
@Override
protected ListSchemaRevisionsPage createPage(
PageContext context,
ListSchemaRevisionsResponse response) {
return new ListSchemaRevisionsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListSchemaRevisionsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListSchemaRevisionsRequest,
ListSchemaRevisionsResponse,
Schema,
ListSchemaRevisionsPage,
ListSchemaRevisionsFixedSizeCollection> {
private ListSchemaRevisionsFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListSchemaRevisionsFixedSizeCollection createEmptyCollection() {
return new ListSchemaRevisionsFixedSizeCollection(null, 0);
}
@Override
protected ListSchemaRevisionsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListSchemaRevisionsFixedSizeCollection(pages, collectionSize);
}
}
}