Class SchemaServiceClient
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
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:
// 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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns 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:
// 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:
// 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:
// 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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
-
Constructor Summary
ModifierConstructorDescriptionprotected
SchemaServiceClient
(SchemaServiceSettings settings) Constructs an instance of SchemaServiceClient, using the given settings.protected
-
Method Summary
Modifier and TypeMethodDescriptionboolean
awaitTermination
(long duration, TimeUnit unit) final void
close()
final Schema
commitSchema
(CommitSchemaRequest request) Commits a new schema revision to an existing schema.final Schema
commitSchema
(SchemaName name, Schema schema) Commits a new schema revision to an existing schema.final Schema
commitSchema
(String name, Schema schema) Commits a new schema revision to an existing schema.final com.google.api.gax.rpc.UnaryCallable<CommitSchemaRequest,
Schema> Commits a new schema revision to an existing schema.static final SchemaServiceClient
create()
Constructs an instance of SchemaServiceClient with default settings.static final SchemaServiceClient
create
(SchemaServiceSettings settings) Constructs an instance of SchemaServiceClient, using the given settings.static final SchemaServiceClient
create
(SchemaServiceStub stub) Constructs an instance of SchemaServiceClient, using the given stub for making calls.final Schema
createSchema
(CreateSchemaRequest request) Creates a schema.final Schema
createSchema
(ProjectName parent, Schema schema, String schemaId) Creates a schema.final Schema
createSchema
(String parent, Schema schema, String schemaId) Creates a schema.final com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,
Schema> Creates a schema.final void
deleteSchema
(DeleteSchemaRequest request) Deletes a schema.final void
deleteSchema
(SchemaName name) Deletes a schema.final void
deleteSchema
(String name) Deletes a schema.final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,
com.google.protobuf.Empty> Deletes a schema.final Schema
Deletes a specific schema revision.final Schema
deleteSchemaRevision
(SchemaName name, String revisionId) Deletes a specific schema revision.final Schema
deleteSchemaRevision
(String name, String revisionId) Deletes a specific schema revision.final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRevisionRequest,
Schema> Deletes a specific schema revision.final com.google.iam.v1.Policy
getIamPolicy
(com.google.iam.v1.GetIamPolicyRequest request) Gets the access control policy for a resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,
com.google.iam.v1.Policy> Gets the access control policy for a resource.final Schema
getSchema
(GetSchemaRequest request) Gets a schema.final Schema
getSchema
(SchemaName name) Gets a schema.final Schema
Gets a schema.final com.google.api.gax.rpc.UnaryCallable<GetSchemaRequest,
Schema> Gets a schema.final SchemaServiceSettings
getStub()
boolean
boolean
Lists all schema revisions for the named schema.Lists all schema revisions for the named schema.listSchemaRevisions
(String name) Lists all schema revisions for the named schema.final com.google.api.gax.rpc.UnaryCallable<ListSchemaRevisionsRequest,
ListSchemaRevisionsResponse> Lists all schema revisions for the named schema.final com.google.api.gax.rpc.UnaryCallable<ListSchemaRevisionsRequest,
SchemaServiceClient.ListSchemaRevisionsPagedResponse> Lists all schema revisions for the named schema.listSchemas
(ListSchemasRequest request) Lists schemas in a project.listSchemas
(ProjectName parent) Lists schemas in a project.listSchemas
(String parent) Lists schemas in a project.final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,
ListSchemasResponse> Lists schemas in a project.final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,
SchemaServiceClient.ListSchemasPagedResponse> Lists schemas in a project.final Schema
rollbackSchema
(RollbackSchemaRequest request) Creates a new schema revision that is a copy of the provided revision_id.final Schema
rollbackSchema
(SchemaName name, String revisionId) Creates a new schema revision that is a copy of the provided revision_id.final Schema
rollbackSchema
(String name, String revisionId) Creates a new schema revision that is a copy of the provided revision_id.final com.google.api.gax.rpc.UnaryCallable<RollbackSchemaRequest,
Schema> Creates a new schema revision that is a copy of the provided revision_id.final com.google.iam.v1.Policy
setIamPolicy
(com.google.iam.v1.SetIamPolicyRequest request) Sets the access control policy on the specified resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,
com.google.iam.v1.Policy> Sets the access control policy on the specified resource.void
shutdown()
void
final com.google.iam.v1.TestIamPermissionsResponse
testIamPermissions
(com.google.iam.v1.TestIamPermissionsRequest request) Returns permissions that a caller has on the specified resource.final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,
com.google.iam.v1.TestIamPermissionsResponse> Returns permissions that a caller has on the specified resource.final ValidateMessageResponse
validateMessage
(ValidateMessageRequest request) Validates a message against a schema.final com.google.api.gax.rpc.UnaryCallable<ValidateMessageRequest,
ValidateMessageResponse> Validates a message against a schema.final ValidateSchemaResponse
validateSchema
(ProjectName parent, Schema schema) Validates a schema.final ValidateSchemaResponse
validateSchema
(ValidateSchemaRequest request) Validates a schema.final ValidateSchemaResponse
validateSchema
(String parent, Schema schema) Validates a schema.final com.google.api.gax.rpc.UnaryCallable<ValidateSchemaRequest,
ValidateSchemaResponse> Validates a schema.
-
Constructor Details
-
SchemaServiceClient
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.- Throws:
IOException
-
SchemaServiceClient
-
-
Method Details
-
create
Constructs an instance of SchemaServiceClient with default settings.- Throws:
IOException
-
create
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.- Throws:
IOException
-
create
Constructs an instance of SchemaServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(SchemaServiceSettings). -
getSettings
-
getStub
-
createSchema
Creates a schema.Sample 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); }
- Parameters:
parent
- Required. The name of the project in which to create the schema. Format is `projects/{project-id}`.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`.
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
-
createSchema
Creates a schema.Sample 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); }
- Parameters:
parent
- Required. The name of the project in which to create the schema. Format is `projects/{project-id}`.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`.
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
-
createSchema
Creates a schema.Sample 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); }
- Parameters:
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
-
createSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,Schema> createSchemaCallable()Creates a schema.Sample 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<Schema> future = schemaServiceClient.createSchemaCallable().futureCall(request); // Do something. Schema response = future.get(); }
-
getSchema
Gets a schema.Sample 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); }
- Parameters:
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
-
getSchema
Gets a schema.Sample 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); }
- Parameters:
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
-
getSchema
Gets a schema.Sample 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); }
- Parameters:
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
-
getSchemaCallable
Gets a schema.Sample 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<Schema> future = schemaServiceClient.getSchemaCallable().futureCall(request); // Do something. Schema response = future.get(); }
-
listSchemas
Lists schemas in a project.Sample 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); } }
- Parameters:
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
-
listSchemas
Lists schemas in a project.Sample 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); } }
- Parameters:
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
-
listSchemas
Lists schemas in a project.Sample 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); } }
- Parameters:
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
-
listSchemasPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,SchemaServiceClient.ListSchemasPagedResponse> listSchemasPagedCallable()Lists schemas in a project.Sample 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<Schema> future = schemaServiceClient.listSchemasPagedCallable().futureCall(request); // Do something. for (Schema element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listSchemasCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,ListSchemasResponse> listSchemasCallable()Lists schemas in a project.Sample 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; } } }
-
listSchemaRevisions
public final SchemaServiceClient.ListSchemaRevisionsPagedResponse listSchemaRevisions(SchemaName name) Lists all schema revisions for the named schema.Sample 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); } }
- Parameters:
name
- Required. The name of the schema to list revisions for.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSchemaRevisions
Lists all schema revisions for the named schema.Sample 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); } }
- Parameters:
name
- Required. The name of the schema to list revisions for.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listSchemaRevisions
public final SchemaServiceClient.ListSchemaRevisionsPagedResponse listSchemaRevisions(ListSchemaRevisionsRequest request) Lists all schema revisions for the named schema.Sample 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); } }
- Parameters:
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
-
listSchemaRevisionsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSchemaRevisionsRequest,SchemaServiceClient.ListSchemaRevisionsPagedResponse> listSchemaRevisionsPagedCallable()Lists all schema revisions for the named schema.Sample 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<Schema> future = schemaServiceClient.listSchemaRevisionsPagedCallable().futureCall(request); // Do something. for (Schema element : future.get().iterateAll()) { // doThingsWith(element); } }
-
listSchemaRevisionsCallable
public final com.google.api.gax.rpc.UnaryCallable<ListSchemaRevisionsRequest,ListSchemaRevisionsResponse> listSchemaRevisionsCallable()Lists all schema revisions for the named schema.Sample 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; } } }
-
commitSchema
Commits a new schema revision to an existing schema.Sample 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); }
- Parameters:
name
- Required. The name of the schema we are revising. Format is `projects/{project}/schemas/{schema}`.schema
- Required. The schema revision to commit.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
commitSchema
Commits a new schema revision to an existing schema.Sample 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); }
- Parameters:
name
- Required. The name of the schema we are revising. Format is `projects/{project}/schemas/{schema}`.schema
- Required. The schema revision to commit.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
commitSchema
Commits a new schema revision to an existing schema.Sample 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); }
- Parameters:
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
-
commitSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<CommitSchemaRequest,Schema> commitSchemaCallable()Commits a new schema revision to an existing schema.Sample 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<Schema> future = schemaServiceClient.commitSchemaCallable().futureCall(request); // Do something. Schema response = future.get(); }
-
rollbackSchema
Creates a new schema revision that is a copy of the provided revision_id.Sample 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); }
- Parameters:
name
- Required. The schema being rolled back with revision id.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
-
rollbackSchema
Creates a new schema revision that is a copy of the provided revision_id.Sample 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); }
- Parameters:
name
- Required. The schema being rolled back with revision id.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
-
rollbackSchema
Creates a new schema revision that is a copy of the provided revision_id.Sample 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); }
- Parameters:
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
-
rollbackSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<RollbackSchemaRequest,Schema> rollbackSchemaCallable()Creates a new schema revision that is a copy of the provided revision_id.Sample 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<Schema> future = schemaServiceClient.rollbackSchemaCallable().futureCall(request); // Do something. Schema response = future.get(); }
-
deleteSchemaRevision
Deletes a specific schema revision.Sample 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); }
- Parameters:
name
- Required. The name of the schema revision to be deleted, with a revision ID explicitly included.Example: `projects/123/schemas/my-schema@c7cfa2a8`
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
-
deleteSchemaRevision
Deletes a specific schema revision.Sample 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); }
- Parameters:
name
- Required. The name of the schema revision to be deleted, with a revision ID explicitly included.Example: `projects/123/schemas/my-schema@c7cfa2a8`
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
-
deleteSchemaRevision
Deletes a specific schema revision.Sample 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); }
- Parameters:
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
-
deleteSchemaRevisionCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRevisionRequest,Schema> deleteSchemaRevisionCallable()Deletes a specific schema revision.Sample 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<Schema> future = schemaServiceClient.deleteSchemaRevisionCallable().futureCall(request); // Do something. Schema response = future.get(); }
-
deleteSchema
Deletes a schema.Sample 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); }
- Parameters:
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
-
deleteSchema
Deletes a schema.Sample 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); }
- Parameters:
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
-
deleteSchema
Deletes a schema.Sample 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); }
- Parameters:
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
-
deleteSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,com.google.protobuf.Empty> deleteSchemaCallable()Deletes a schema.Sample 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<Empty> future = schemaServiceClient.deleteSchemaCallable().futureCall(request); // Do something. future.get(); }
-
validateSchema
Validates a schema.Sample 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); }
- Parameters:
parent
- Required. The name of the project in which to validate schemas. Format is `projects/{project-id}`.schema
- Required. The schema object to validate.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
validateSchema
Validates a schema.Sample 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); }
- Parameters:
parent
- Required. The name of the project in which to validate schemas. Format is `projects/{project-id}`.schema
- Required. The schema object to validate.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
validateSchema
Validates a schema.Sample 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); }
- Parameters:
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
-
validateSchemaCallable
public final com.google.api.gax.rpc.UnaryCallable<ValidateSchemaRequest,ValidateSchemaResponse> validateSchemaCallable()Validates a schema.Sample 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<ValidateSchemaResponse> future = schemaServiceClient.validateSchemaCallable().futureCall(request); // Do something. ValidateSchemaResponse response = future.get(); }
-
validateMessage
Validates a message against a schema.Sample 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); }
- Parameters:
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
-
validateMessageCallable
public final com.google.api.gax.rpc.UnaryCallable<ValidateMessageRequest,ValidateMessageResponse> validateMessageCallable()Validates a message against a schema.Sample 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<ValidateMessageResponse> future = schemaServiceClient.validateMessageCallable().futureCall(request); // Do something. ValidateMessageResponse response = future.get(); }
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample 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); }
- Parameters:
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
-
setIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()Sets the access control policy on the specified resource. Replacesany existing policy.Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample 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<Policy> future = schemaServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample 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); }
- Parameters:
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
-
getIamPolicyCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.Sample 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<Policy> future = schemaServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); }
-
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) 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:
// 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<String>()) .build(); TestIamPermissionsResponse response = schemaServiceClient.testIamPermissions(request); }
- Parameters:
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
-
testIamPermissionsCallable
public final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()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:
// 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<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = schemaServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); }
-
close
public final void close()- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-