@Generated(value="by gapic-generator-java") public class SchemaServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
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:
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.newBuilder()
.setTransportChannelProvider(
SchemaServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
.build();
SchemaServiceClient schemaServiceClient = SchemaServiceClient.create(schemaServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
SchemaServiceClient.ListSchemasFixedSizeCollection |
static class |
SchemaServiceClient.ListSchemasPage |
static class |
SchemaServiceClient.ListSchemasPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
SchemaServiceClient(SchemaServiceSettings settings)
Constructs an instance of SchemaServiceClient, using the given settings.
|
protected |
SchemaServiceClient(SchemaServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static SchemaServiceClient |
create()
Constructs an instance of SchemaServiceClient with default settings.
|
static SchemaServiceClient |
create(SchemaServiceSettings settings)
Constructs an instance of SchemaServiceClient, using the given settings.
|
static SchemaServiceClient |
create(SchemaServiceStub stub)
Constructs an instance of SchemaServiceClient, using the given stub for making calls.
|
Schema |
createSchema(CreateSchemaRequest request)
Creates a schema.
|
Schema |
createSchema(ProjectName parent,
Schema schema,
String schemaId)
Creates a schema.
|
Schema |
createSchema(String parent,
Schema schema,
String schemaId)
Creates a schema.
|
com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,Schema> |
createSchemaCallable()
Creates a schema.
|
void |
deleteSchema(DeleteSchemaRequest request)
Deletes a schema.
|
void |
deleteSchema(SchemaName name)
Deletes a schema.
|
void |
deleteSchema(String name)
Deletes a schema.
|
com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,com.google.protobuf.Empty> |
deleteSchemaCallable()
Deletes a schema.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
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.
|
Schema |
getSchema(GetSchemaRequest request)
Gets a schema.
|
Schema |
getSchema(SchemaName name)
Gets a schema.
|
Schema |
getSchema(String name)
Gets a schema.
|
com.google.api.gax.rpc.UnaryCallable<GetSchemaRequest,Schema> |
getSchemaCallable()
Gets a schema.
|
SchemaServiceSettings |
getSettings() |
SchemaServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(ListSchemasRequest request)
Lists schemas in a project.
|
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(ProjectName parent)
Lists schemas in a project.
|
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(String parent)
Lists schemas in a project.
|
com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,ListSchemasResponse> |
listSchemasCallable()
Lists schemas in a project.
|
com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,SchemaServiceClient.ListSchemasPagedResponse> |
listSchemasPagedCallable()
Lists schemas in a project.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
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.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
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.
|
ValidateMessageResponse |
validateMessage(ValidateMessageRequest request)
Validates a message against a schema.
|
com.google.api.gax.rpc.UnaryCallable<ValidateMessageRequest,ValidateMessageResponse> |
validateMessageCallable()
Validates a message against a schema.
|
ValidateSchemaResponse |
validateSchema(ProjectName parent,
Schema schema)
Validates a schema.
|
ValidateSchemaResponse |
validateSchema(String parent,
Schema schema)
Validates a schema.
|
ValidateSchemaResponse |
validateSchema(ValidateSchemaRequest request)
Validates a schema.
|
com.google.api.gax.rpc.UnaryCallable<ValidateSchemaRequest,ValidateSchemaResponse> |
validateSchemaCallable()
Validates a schema.
|
protected SchemaServiceClient(SchemaServiceSettings settings) throws IOException
IOExceptionprotected SchemaServiceClient(SchemaServiceStub stub)
public static final SchemaServiceClient create() throws IOException
IOExceptionpublic static final SchemaServiceClient create(SchemaServiceSettings settings) throws IOException
IOExceptionpublic static final SchemaServiceClient create(SchemaServiceStub stub)
public final SchemaServiceSettings getSettings()
public SchemaServiceStub getStub()
public final Schema createSchema(ProjectName parent, Schema schema, String schemaId)
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);
}
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.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Schema createSchema(String parent, Schema schema, String schemaId)
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);
}
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.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Schema createSchema(CreateSchemaRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,Schema> createSchemaCallable()
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();
}
public final Schema getSchema(SchemaName name)
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);
}
name - Required. The name of the schema to get. Format is
`projects/{project}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Schema getSchema(String name)
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);
}
name - Required. The name of the schema to get. Format is
`projects/{project}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Schema getSchema(GetSchemaRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetSchemaRequest,Schema> getSchemaCallable()
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();
}
public final SchemaServiceClient.ListSchemasPagedResponse listSchemas(ProjectName parent)
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);
}
}
parent - Required. The name of the project in which to list schemas. Format is
`projects/{project-id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SchemaServiceClient.ListSchemasPagedResponse listSchemas(String parent)
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);
}
}
parent - Required. The name of the project in which to list schemas. Format is
`projects/{project-id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final SchemaServiceClient.ListSchemasPagedResponse listSchemas(ListSchemasRequest request)
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);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,SchemaServiceClient.ListSchemasPagedResponse> listSchemasPagedCallable()
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);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,ListSchemasResponse> listSchemasCallable()
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;
}
}
}
public final void deleteSchema(SchemaName name)
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);
}
name - Required. Name of the schema to delete. Format is
`projects/{project}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSchema(String name)
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);
}
name - Required. Name of the schema to delete. Format is
`projects/{project}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteSchema(DeleteSchemaRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,com.google.protobuf.Empty> deleteSchemaCallable()
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();
}
public final ValidateSchemaResponse validateSchema(ProjectName parent, Schema 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);
}
parent - Required. The name of the project in which to validate schemas. Format is
`projects/{project-id}`.schema - Required. The schema object to validate.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ValidateSchemaResponse validateSchema(String parent, Schema 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);
}
parent - Required. The name of the project in which to validate schemas. Format is
`projects/{project-id}`.schema - Required. The schema object to validate.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ValidateSchemaResponse validateSchema(ValidateSchemaRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ValidateSchemaRequest,ValidateSchemaResponse> validateSchemaCallable()
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();
}
public final ValidateMessageResponse validateMessage(ValidateMessageRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ValidateMessageRequest,ValidateMessageResponse> validateMessageCallable()
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();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
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();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
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();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying 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);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
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();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2022 Google LLC. All rights reserved.