@BetaApi @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()) {
SchemaName name =
SchemaName.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]");
Schema response = schemaServiceClient.getSchema(name);
}
Note: close() needs to be called on the SchemaServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
GetSchema |
Gets a [Schema][google.cloud.discoveryengine.v1alpha.Schema]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListSchemas |
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateSchema |
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateSchema |
Updates a [Schema][google.cloud.discoveryengine.v1alpha.Schema]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteSchema |
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema]. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of SchemaServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require 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.
| 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.
|
com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> |
createSchemaAsync(CreateSchemaRequest request)
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> |
createSchemaAsync(DataStoreName parent,
Schema schema,
String schemaId)
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> |
createSchemaAsync(String parent,
Schema schema,
String schemaId)
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,com.google.longrunning.Operation> |
createSchemaCallable()
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.OperationCallable<CreateSchemaRequest,Schema,CreateSchemaMetadata> |
createSchemaOperationCallable()
Creates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> |
deleteSchemaAsync(DeleteSchemaRequest request)
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> |
deleteSchemaAsync(SchemaName name)
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> |
deleteSchemaAsync(String name)
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,com.google.longrunning.Operation> |
deleteSchemaCallable()
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.OperationCallable<DeleteSchemaRequest,com.google.protobuf.Empty,DeleteSchemaMetadata> |
deleteSchemaOperationCallable()
Deletes a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Schema |
getSchema(GetSchemaRequest request)
Gets a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
Schema |
getSchema(SchemaName name)
Gets a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
Schema |
getSchema(String name)
Gets a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.UnaryCallable<GetSchemaRequest,Schema> |
getSchemaCallable()
Gets a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
SchemaServiceSettings |
getSettings() |
SchemaServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(DataStoreName parent)
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s.
|
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(ListSchemasRequest request)
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s.
|
SchemaServiceClient.ListSchemasPagedResponse |
listSchemas(String parent)
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s.
|
com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,ListSchemasResponse> |
listSchemasCallable()
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s.
|
com.google.api.gax.rpc.UnaryCallable<ListSchemasRequest,SchemaServiceClient.ListSchemasPagedResponse> |
listSchemasPagedCallable()
Gets a list of [Schema][google.cloud.discoveryengine.v1alpha.Schema]s.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Schema,UpdateSchemaMetadata> |
updateSchemaAsync(UpdateSchemaRequest request)
Updates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.UnaryCallable<UpdateSchemaRequest,com.google.longrunning.Operation> |
updateSchemaCallable()
Updates a [Schema][google.cloud.discoveryengine.v1alpha.Schema].
|
com.google.api.gax.rpc.OperationCallable<UpdateSchemaRequest,Schema,UpdateSchemaMetadata> |
updateSchemaOperationCallable()
Updates a [Schema][google.cloud.discoveryengine.v1alpha.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 com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]");
Schema response = schemaServiceClient.getSchema(name);
}
name - Required. The full resource name of the schema, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString();
Schema response = schemaServiceClient.getSchema(name);
}
name - Required. The full resource name of the schema, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString())
.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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString())
.build();
ApiFuture<Schema> future = schemaServiceClient.getSchemaCallable().futureCall(request);
// Do something.
Schema response = future.get();
}
public final SchemaServiceClient.ListSchemasPagedResponse listSchemas(DataStoreName 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()) {
DataStoreName parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent data store resource name, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.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 =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
for (Schema element : schemaServiceClient.listSchemas(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The parent data store resource name, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.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 com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> createSchemaAsync(DataStoreName 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()) {
DataStoreName parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
Schema schema = Schema.newBuilder().build();
String schemaId = "schemaId-697673060";
Schema response = schemaServiceClient.createSchemaAsync(parent, schema, schemaId).get();
}
parent - Required. The parent data store resource name, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.schema - Required. The [Schema][google.cloud.discoveryengine.v1alpha.Schema] to create.schemaId - Required. The ID to use for the
[Schema][google.cloud.discoveryengine.v1alpha.Schema], which becomes the final component of
the [Schema.name][google.cloud.discoveryengine.v1alpha.Schema.name].
This field should conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> createSchemaAsync(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 =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
Schema schema = Schema.newBuilder().build();
String schemaId = "schemaId-697673060";
Schema response = schemaServiceClient.createSchemaAsync(parent, schema, schemaId).get();
}
parent - Required. The parent data store resource name, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.schema - Required. The [Schema][google.cloud.discoveryengine.v1alpha.Schema] to create.schemaId - Required. The ID to use for the
[Schema][google.cloud.discoveryengine.v1alpha.Schema], which becomes the final component of
the [Schema.name][google.cloud.discoveryengine.v1alpha.Schema.name].
This field should conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length limit of 63 characters.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Schema,CreateSchemaMetadata> createSchemaAsync(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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setSchema(Schema.newBuilder().build())
.setSchemaId("schemaId-697673060")
.build();
Schema response = schemaServiceClient.createSchemaAsync(request).get();
}
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.OperationCallable<CreateSchemaRequest,Schema,CreateSchemaMetadata> createSchemaOperationCallable()
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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setSchema(Schema.newBuilder().build())
.setSchemaId("schemaId-697673060")
.build();
OperationFuture<Schema, CreateSchemaMetadata> future =
schemaServiceClient.createSchemaOperationCallable().futureCall(request);
// Do something.
Schema response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateSchemaRequest,com.google.longrunning.Operation> 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(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setSchema(Schema.newBuilder().build())
.setSchemaId("schemaId-697673060")
.build();
ApiFuture<Operation> future = schemaServiceClient.createSchemaCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Schema,UpdateSchemaMetadata> updateSchemaAsync(UpdateSchemaRequest 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()) {
UpdateSchemaRequest request =
UpdateSchemaRequest.newBuilder()
.setSchema(Schema.newBuilder().build())
.setAllowMissing(true)
.build();
Schema response = schemaServiceClient.updateSchemaAsync(request).get();
}
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.OperationCallable<UpdateSchemaRequest,Schema,UpdateSchemaMetadata> updateSchemaOperationCallable()
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()) {
UpdateSchemaRequest request =
UpdateSchemaRequest.newBuilder()
.setSchema(Schema.newBuilder().build())
.setAllowMissing(true)
.build();
OperationFuture<Schema, UpdateSchemaMetadata> future =
schemaServiceClient.updateSchemaOperationCallable().futureCall(request);
// Do something.
Schema response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateSchemaRequest,com.google.longrunning.Operation> updateSchemaCallable()
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()) {
UpdateSchemaRequest request =
UpdateSchemaRequest.newBuilder()
.setSchema(Schema.newBuilder().build())
.setAllowMissing(true)
.build();
ApiFuture<Operation> future = schemaServiceClient.updateSchemaCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> deleteSchemaAsync(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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]");
schemaServiceClient.deleteSchemaAsync(name).get();
}
name - Required. The full resource name of the schema, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> deleteSchemaAsync(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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString();
schemaServiceClient.deleteSchemaAsync(name).get();
}
name - Required. The full resource name of the schema, in the format of
`projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,DeleteSchemaMetadata> deleteSchemaAsync(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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString())
.build();
schemaServiceClient.deleteSchemaAsync(request).get();
}
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.OperationCallable<DeleteSchemaRequest,com.google.protobuf.Empty,DeleteSchemaMetadata> deleteSchemaOperationCallable()
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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString())
.build();
OperationFuture<Empty, DeleteSchemaMetadata> future =
schemaServiceClient.deleteSchemaOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteSchemaRequest,com.google.longrunning.Operation> 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.ofProjectLocationDataStoreSchemaName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SCHEMA]")
.toString())
.build();
ApiFuture<Operation> future = schemaServiceClient.deleteSchemaCallable().futureCall(request);
// Do something.
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 © 2024 Google LLC. All rights reserved.