Class DataObjectServiceClient
- All Implemented Interfaces:
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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) {
CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
DataObject dataObject = DataObject.newBuilder().build();
String dataObjectId = "dataObjectId1417732740";
DataObject response =
dataObjectServiceClient.createDataObject(parent, dataObject, dataObjectId);
}
Note: close() needs to be called on the DataObjectServiceClient 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 |
|---|---|---|
CreateDataObject |
Creates a dataObject. |
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.
|
BatchCreateDataObjects |
Creates a batch of dataObjects. |
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.
|
GetDataObject |
Gets a data object. |
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.
|
UpdateDataObject |
Updates a dataObject. |
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.
|
BatchUpdateDataObjects |
Updates dataObjects in a batch. |
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.
|
DeleteDataObject |
Deletes a dataObject. |
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.
|
BatchDeleteDataObjects |
Deletes dataObjects in a batch. |
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.
|
ListLocations |
Lists information about the supported locations for this service. This method lists locations based on the resource scope provided inthe [ListLocationsRequest.name] field: * **Global locations**: If `name` is empty, the method lists thepublic locations available to all projects. * **Project-specificlocations**: If `name` follows the format`projects/{project}`, the method lists locations visible to thatspecific project. This includes public, private, or otherproject-specific locations enabled for the project. For gRPC and client library implementations, the resource name ispassed as the `name` field. For direct service calls, the resourcename isincorporated into the request path based on the specific serviceimplementation and version. |
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.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of DataObjectServiceSettings 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
DataObjectServiceSettings dataObjectServiceSettings =
DataObjectServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
DataObjectServiceClient dataObjectServiceClient =
DataObjectServiceClient.create(dataObjectServiceSettings);
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
DataObjectServiceSettings dataObjectServiceSettings =
DataObjectServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
DataObjectServiceClient dataObjectServiceClient =
DataObjectServiceClient.create(dataObjectServiceSettings);
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
DataObjectServiceSettings dataObjectServiceSettings =
DataObjectServiceSettings.newHttpJsonBuilder().build();
DataObjectServiceClient dataObjectServiceClient =
DataObjectServiceClient.create(dataObjectServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of DataObjectServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) Creates a batch of dataObjects.Creates a batch of dataObjects.final voidDeletes dataObjects in a batch.final voidbatchDeleteDataObjects(CollectionName parent, List<DeleteDataObjectRequest> requests) Deletes dataObjects in a batch.final voidbatchDeleteDataObjects(String parent, List<DeleteDataObjectRequest> requests) Deletes dataObjects in a batch.final UnaryCallable<BatchDeleteDataObjectsRequest,com.google.protobuf.Empty> Deletes dataObjects in a batch.Updates dataObjects in a batch.batchUpdateDataObjects(CollectionName parent, List<UpdateDataObjectRequest> requests) Updates dataObjects in a batch.batchUpdateDataObjects(String parent, List<UpdateDataObjectRequest> requests) Updates dataObjects in a batch.Updates dataObjects in a batch.final voidclose()static final DataObjectServiceClientcreate()Constructs an instance of DataObjectServiceClient with default settings.static final DataObjectServiceClientcreate(DataObjectServiceSettings settings) Constructs an instance of DataObjectServiceClient, using the given settings.static final DataObjectServiceClientcreate(DataObjectServiceStub stub) Constructs an instance of DataObjectServiceClient, using the given stub for making calls.final DataObjectcreateDataObject(CollectionName parent, DataObject dataObject, String dataObjectId) Creates a dataObject.final DataObjectcreateDataObject(CreateDataObjectRequest request) Creates a dataObject.final DataObjectcreateDataObject(String parent, DataObject dataObject, String dataObjectId) Creates a dataObject.Creates a dataObject.final voidDeletes a dataObject.final voiddeleteDataObject(DeleteDataObjectRequest request) Deletes a dataObject.final voiddeleteDataObject(String name) Deletes a dataObject.final UnaryCallable<DeleteDataObjectRequest,com.google.protobuf.Empty> Deletes a dataObject.final DataObjectgetDataObject(DataObjectName name) Gets a data object.final DataObjectgetDataObject(GetDataObjectRequest request) Gets a data object.final DataObjectgetDataObject(String name) Gets a data object.Gets a data object.final LocationgetLocation(GetLocationRequest request) Gets information about a location.Gets information about a location.getStub()booleanbooleanlistLocations(ListLocationsRequest request) Lists information about the supported locations for this service.Lists information about the supported locations for this service.Lists information about the supported locations for this service.voidshutdown()voidfinal DataObjectupdateDataObject(DataObject dataObject, com.google.protobuf.FieldMask updateMask) Updates a dataObject.final DataObjectupdateDataObject(UpdateDataObjectRequest request) Updates a dataObject.Updates a dataObject.
-
Constructor Details
-
DataObjectServiceClient
Constructs an instance of DataObjectServiceClient, 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
-
DataObjectServiceClient
-
-
Method Details
-
create
Constructs an instance of DataObjectServiceClient with default settings.- Throws:
IOException
-
create
public static final DataObjectServiceClient create(DataObjectServiceSettings settings) throws IOException Constructs an instance of DataObjectServiceClient, 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 DataObjectServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(DataObjectServiceSettings). -
getSettings
-
getStub
-
createDataObject
public final DataObject createDataObject(CollectionName parent, DataObject dataObject, String dataObjectId) Creates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]"); DataObject dataObject = DataObject.newBuilder().build(); String dataObjectId = "dataObjectId1417732740"; DataObject response = dataObjectServiceClient.createDataObject(parent, dataObject, dataObjectId); }- Parameters:
parent- Required. The resource name of the Collection to create the DataObject in. Format: `projects/{project}/locations/{location}/collections/{collection}`dataObject- Required. The DataObject to create.dataObjectId- Required. The id of the dataObject to create. The id must be 1-63 characters long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Specifically, it must be 1-63 characters long and match the regular expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.- Throws:
ApiException- if the remote call fails
-
createDataObject
Creates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString(); DataObject dataObject = DataObject.newBuilder().build(); String dataObjectId = "dataObjectId1417732740"; DataObject response = dataObjectServiceClient.createDataObject(parent, dataObject, dataObjectId); }- Parameters:
parent- Required. The resource name of the Collection to create the DataObject in. Format: `projects/{project}/locations/{location}/collections/{collection}`dataObject- Required. The DataObject to create.dataObjectId- Required. The id of the dataObject to create. The id must be 1-63 characters long, and comply with [RFC1035](https://www.ietf.org/rfc/rfc1035.txt). Specifically, it must be 1-63 characters long and match the regular expression `[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?`.- Throws:
ApiException- if the remote call fails
-
createDataObject
Creates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { CreateDataObjectRequest request = CreateDataObjectRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .setDataObjectId("dataObjectId1417732740") .setDataObject(DataObject.newBuilder().build()) .build(); DataObject response = dataObjectServiceClient.createDataObject(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createDataObjectCallable
Creates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { CreateDataObjectRequest request = CreateDataObjectRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .setDataObjectId("dataObjectId1417732740") .setDataObject(DataObject.newBuilder().build()) .build(); ApiFuture<DataObject> future = dataObjectServiceClient.createDataObjectCallable().futureCall(request); // Do something. DataObject response = future.get(); } -
batchCreateDataObjects
public final BatchCreateDataObjectsResponse batchCreateDataObjects(BatchCreateDataObjectsRequest request) Creates a batch of dataObjects.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchCreateDataObjectsRequest request = BatchCreateDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<CreateDataObjectRequest>()) .build(); BatchCreateDataObjectsResponse response = dataObjectServiceClient.batchCreateDataObjects(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
batchCreateDataObjectsCallable
public final UnaryCallable<BatchCreateDataObjectsRequest,BatchCreateDataObjectsResponse> batchCreateDataObjectsCallable()Creates a batch of dataObjects.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchCreateDataObjectsRequest request = BatchCreateDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<CreateDataObjectRequest>()) .build(); ApiFuture<BatchCreateDataObjectsResponse> future = dataObjectServiceClient.batchCreateDataObjectsCallable().futureCall(request); // Do something. BatchCreateDataObjectsResponse response = future.get(); } -
getDataObject
Gets a data object.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { DataObjectName name = DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]"); DataObject response = dataObjectServiceClient.getDataObject(name); }- Parameters:
name- Required. The name of the DataObject resource. Format: `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`- Throws:
ApiException- if the remote call fails
-
getDataObject
Gets a data object.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { String name = DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]").toString(); DataObject response = dataObjectServiceClient.getDataObject(name); }- Parameters:
name- Required. The name of the DataObject resource. Format: `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`- Throws:
ApiException- if the remote call fails
-
getDataObject
Gets a data object.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { GetDataObjectRequest request = GetDataObjectRequest.newBuilder() .setName( DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]") .toString()) .build(); DataObject response = dataObjectServiceClient.getDataObject(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getDataObjectCallable
Gets a data object.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { GetDataObjectRequest request = GetDataObjectRequest.newBuilder() .setName( DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]") .toString()) .build(); ApiFuture<DataObject> future = dataObjectServiceClient.getDataObjectCallable().futureCall(request); // Do something. DataObject response = future.get(); } -
updateDataObject
public final DataObject updateDataObject(DataObject dataObject, com.google.protobuf.FieldMask updateMask) Updates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { DataObject dataObject = DataObject.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); DataObject response = dataObjectServiceClient.updateDataObject(dataObject, updateMask); }- Parameters:
dataObject- Required. The DataObject which replaces the resource on the server.updateMask- Optional. The update mask applies to the resource. See [google.protobuf.FieldMask][google.protobuf.FieldMask].- Throws:
ApiException- if the remote call fails
-
updateDataObject
Updates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { UpdateDataObjectRequest request = UpdateDataObjectRequest.newBuilder() .setDataObject(DataObject.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); DataObject response = dataObjectServiceClient.updateDataObject(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateDataObjectCallable
Updates a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { UpdateDataObjectRequest request = UpdateDataObjectRequest.newBuilder() .setDataObject(DataObject.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<DataObject> future = dataObjectServiceClient.updateDataObjectCallable().futureCall(request); // Do something. DataObject response = future.get(); } -
batchUpdateDataObjects
public final BatchUpdateDataObjectsResponse batchUpdateDataObjects(CollectionName parent, List<UpdateDataObjectRequest> requests) Updates dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]"); List<UpdateDataObjectRequest> requests = new ArrayList<>(); BatchUpdateDataObjectsResponse response = dataObjectServiceClient.batchUpdateDataObjects(parent, requests); }- Parameters:
parent- Required. The resource name of the Collection to update the DataObjects in. Format: `projects/{project}/locations/{location}/collections/{collection}`. The parent field in the UpdateDataObjectRequest messages must match this field.requests- Required. The request message specifying the resources to update. A maximum of 1000 DataObjects can be updated in a batch.- Throws:
ApiException- if the remote call fails
-
batchUpdateDataObjects
public final BatchUpdateDataObjectsResponse batchUpdateDataObjects(String parent, List<UpdateDataObjectRequest> requests) Updates dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString(); List<UpdateDataObjectRequest> requests = new ArrayList<>(); BatchUpdateDataObjectsResponse response = dataObjectServiceClient.batchUpdateDataObjects(parent, requests); }- Parameters:
parent- Required. The resource name of the Collection to update the DataObjects in. Format: `projects/{project}/locations/{location}/collections/{collection}`. The parent field in the UpdateDataObjectRequest messages must match this field.requests- Required. The request message specifying the resources to update. A maximum of 1000 DataObjects can be updated in a batch.- Throws:
ApiException- if the remote call fails
-
batchUpdateDataObjects
public final BatchUpdateDataObjectsResponse batchUpdateDataObjects(BatchUpdateDataObjectsRequest request) Updates dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchUpdateDataObjectsRequest request = BatchUpdateDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<UpdateDataObjectRequest>()) .build(); BatchUpdateDataObjectsResponse response = dataObjectServiceClient.batchUpdateDataObjects(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
batchUpdateDataObjectsCallable
public final UnaryCallable<BatchUpdateDataObjectsRequest,BatchUpdateDataObjectsResponse> batchUpdateDataObjectsCallable()Updates dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchUpdateDataObjectsRequest request = BatchUpdateDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<UpdateDataObjectRequest>()) .build(); ApiFuture<BatchUpdateDataObjectsResponse> future = dataObjectServiceClient.batchUpdateDataObjectsCallable().futureCall(request); // Do something. BatchUpdateDataObjectsResponse response = future.get(); } -
deleteDataObject
Deletes a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { DataObjectName name = DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]"); dataObjectServiceClient.deleteDataObject(name); }- Parameters:
name- Required. The name of the DataObject resource to be deleted. Format: `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`- Throws:
ApiException- if the remote call fails
-
deleteDataObject
Deletes a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { String name = DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]").toString(); dataObjectServiceClient.deleteDataObject(name); }- Parameters:
name- Required. The name of the DataObject resource to be deleted. Format: `projects/{project}/locations/{location}/collections/{collection}/dataObjects/{dataObject}`- Throws:
ApiException- if the remote call fails
-
deleteDataObject
Deletes a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { DeleteDataObjectRequest request = DeleteDataObjectRequest.newBuilder() .setName( DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]") .toString()) .setEtag("etag3123477") .build(); dataObjectServiceClient.deleteDataObject(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteDataObjectCallable
public final UnaryCallable<DeleteDataObjectRequest,com.google.protobuf.Empty> deleteDataObjectCallable()Deletes a dataObject.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { DeleteDataObjectRequest request = DeleteDataObjectRequest.newBuilder() .setName( DataObjectName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[DATAOBJECT]") .toString()) .setEtag("etag3123477") .build(); ApiFuture<Empty> future = dataObjectServiceClient.deleteDataObjectCallable().futureCall(request); // Do something. future.get(); } -
batchDeleteDataObjects
public final void batchDeleteDataObjects(CollectionName parent, List<DeleteDataObjectRequest> requests) Deletes dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]"); List<DeleteDataObjectRequest> requests = new ArrayList<>(); dataObjectServiceClient.batchDeleteDataObjects(parent, requests); }- Parameters:
parent- Required. The resource name of the Collection to delete the DataObjects in. Format: `projects/{project}/locations/{location}/collections/{collection}`.requests- Required. The request message specifying the resources to delete. A maximum of 1000 DataObjects can be deleted in a batch.- Throws:
ApiException- if the remote call fails
-
batchDeleteDataObjects
Deletes dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString(); List<DeleteDataObjectRequest> requests = new ArrayList<>(); dataObjectServiceClient.batchDeleteDataObjects(parent, requests); }- Parameters:
parent- Required. The resource name of the Collection to delete the DataObjects in. Format: `projects/{project}/locations/{location}/collections/{collection}`.requests- Required. The request message specifying the resources to delete. A maximum of 1000 DataObjects can be deleted in a batch.- Throws:
ApiException- if the remote call fails
-
batchDeleteDataObjects
Deletes dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchDeleteDataObjectsRequest request = BatchDeleteDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<DeleteDataObjectRequest>()) .build(); dataObjectServiceClient.batchDeleteDataObjects(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
batchDeleteDataObjectsCallable
public final UnaryCallable<BatchDeleteDataObjectsRequest,com.google.protobuf.Empty> batchDeleteDataObjectsCallable()Deletes dataObjects in a batch.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { BatchDeleteDataObjectsRequest request = BatchDeleteDataObjectsRequest.newBuilder() .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString()) .addAllRequests(new ArrayList<DeleteDataObjectRequest>()) .build(); ApiFuture<Empty> future = dataObjectServiceClient.batchDeleteDataObjectsCallable().futureCall(request); // Do something. future.get(); } -
listLocations
public final DataObjectServiceClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request) Lists information about the supported locations for this service.This method lists locations based on the resource scope provided inthe [ListLocationsRequest.name] field:
* **Global locations**: If `name` is empty, the method lists thepublic locations available to all projects. * **Project-specificlocations**: If `name` follows the format`projects/{project}`, the method lists locations visible to thatspecific project. This includes public, private, or otherproject-specific locations enabled for the project.
For gRPC and client library implementations, the resource name ispassed as the `name` field. For direct service calls, the resourcename isincorporated into the request path based on the specific serviceimplementation and version.
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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (Location element : dataObjectServiceClient.listLocations(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listLocationsPagedCallable
public final UnaryCallable<ListLocationsRequest,DataObjectServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()Lists information about the supported locations for this service.This method lists locations based on the resource scope provided inthe [ListLocationsRequest.name] field:
* **Global locations**: If `name` is empty, the method lists thepublic locations available to all projects. * **Project-specificlocations**: If `name` follows the format`projects/{project}`, the method lists locations visible to thatspecific project. This includes public, private, or otherproject-specific locations enabled for the project.
For gRPC and client library implementations, the resource name ispassed as the `name` field. For direct service calls, the resourcename isincorporated into the request path based on the specific serviceimplementation and version.
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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<Location> future = dataObjectServiceClient.listLocationsPagedCallable().futureCall(request); // Do something. for (Location element : future.get().iterateAll()) { // doThingsWith(element); } } -
listLocationsCallable
Lists information about the supported locations for this service.This method lists locations based on the resource scope provided inthe [ListLocationsRequest.name] field:
* **Global locations**: If `name` is empty, the method lists thepublic locations available to all projects. * **Project-specificlocations**: If `name` follows the format`projects/{project}`, the method lists locations visible to thatspecific project. This includes public, private, or otherproject-specific locations enabled for the project.
For gRPC and client library implementations, the resource name ispassed as the `name` field. For direct service calls, the resourcename isincorporated into the request path based on the specific serviceimplementation and version.
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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { ListLocationsRequest request = ListLocationsRequest.newBuilder() .setName("name3373707") .setFilter("filter-1274492040") .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListLocationsResponse response = dataObjectServiceClient.listLocationsCallable().call(request); for (Location element : response.getLocationsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
getLocation
Gets information about a location.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); Location response = dataObjectServiceClient.getLocation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getLocationCallable
Gets information about a location.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 (DataObjectServiceClient dataObjectServiceClient = DataObjectServiceClient.create()) { GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); ApiFuture<Location> future = dataObjectServiceClient.getLocationCallable().futureCall(request); // Do something. Location response = future.get(); } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-