@Generated(value="by gapic-generator-java") public class ControlServiceClient 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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
DataStoreName parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
Control control = Control.newBuilder().build();
String controlId = "controlId-395080872";
Control response = controlServiceClient.createControl(parent, control, controlId);
}
Note: close() needs to be called on the ControlServiceClient 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 |
|---|---|---|
CreateControl |
Creates a Control. By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned. |
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.
|
DeleteControl |
Deletes a Control. If the [Control][google.cloud.discoveryengine.v1.Control] to delete does not exist, a NOT_FOUND error is returned. |
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.
|
UpdateControl |
Updates a Control. [Control][google.cloud.discoveryengine.v1.Control] action type cannot be changed. If the [Control][google.cloud.discoveryengine.v1.Control] to update does not exist, a NOT_FOUND error is returned. |
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.
|
GetControl |
Gets a Control. |
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.
|
ListControls |
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore]. |
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.
|
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 ControlServiceSettings 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
ControlServiceSettings controlServiceSettings =
ControlServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
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
ControlServiceSettings controlServiceSettings =
ControlServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
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
ControlServiceSettings controlServiceSettings =
ControlServiceSettings.newHttpJsonBuilder().build();
ControlServiceClient controlServiceClient = ControlServiceClient.create(controlServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
ControlServiceClient.ListControlsFixedSizeCollection |
static class |
ControlServiceClient.ListControlsPage |
static class |
ControlServiceClient.ListControlsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
ControlServiceClient(ControlServiceSettings settings)
Constructs an instance of ControlServiceClient, using the given settings.
|
protected |
ControlServiceClient(ControlServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static ControlServiceClient |
create()
Constructs an instance of ControlServiceClient with default settings.
|
static ControlServiceClient |
create(ControlServiceSettings settings)
Constructs an instance of ControlServiceClient, using the given settings.
|
static ControlServiceClient |
create(ControlServiceStub stub)
Constructs an instance of ControlServiceClient, using the given stub for making calls.
|
Control |
createControl(CreateControlRequest request)
Creates a Control.
|
Control |
createControl(DataStoreName parent,
Control control,
String controlId)
Creates a Control.
|
Control |
createControl(EngineName parent,
Control control,
String controlId)
Creates a Control.
|
Control |
createControl(String parent,
Control control,
String controlId)
Creates a Control.
|
com.google.api.gax.rpc.UnaryCallable<CreateControlRequest,Control> |
createControlCallable()
Creates a Control.
|
void |
deleteControl(ControlName name)
Deletes a Control.
|
void |
deleteControl(DeleteControlRequest request)
Deletes a Control.
|
void |
deleteControl(String name)
Deletes a Control.
|
com.google.api.gax.rpc.UnaryCallable<DeleteControlRequest,com.google.protobuf.Empty> |
deleteControlCallable()
Deletes a Control.
|
Control |
getControl(ControlName name)
Gets a Control.
|
Control |
getControl(GetControlRequest request)
Gets a Control.
|
Control |
getControl(String name)
Gets a Control.
|
com.google.api.gax.rpc.UnaryCallable<GetControlRequest,Control> |
getControlCallable()
Gets a Control.
|
ControlServiceSettings |
getSettings() |
ControlServiceStub |
getStub() |
boolean |
isShutdown() |
boolean |
isTerminated() |
ControlServiceClient.ListControlsPagedResponse |
listControls(DataStoreName parent)
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
ControlServiceClient.ListControlsPagedResponse |
listControls(EngineName parent)
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
ControlServiceClient.ListControlsPagedResponse |
listControls(ListControlsRequest request)
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
ControlServiceClient.ListControlsPagedResponse |
listControls(String parent)
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
com.google.api.gax.rpc.UnaryCallable<ListControlsRequest,ListControlsResponse> |
listControlsCallable()
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
com.google.api.gax.rpc.UnaryCallable<ListControlsRequest,ControlServiceClient.ListControlsPagedResponse> |
listControlsPagedCallable()
Lists all Controls by their parent [DataStore][google.cloud.discoveryengine.v1.DataStore].
|
void |
shutdown() |
void |
shutdownNow() |
Control |
updateControl(Control control,
com.google.protobuf.FieldMask updateMask)
Updates a Control.
|
Control |
updateControl(UpdateControlRequest request)
Updates a Control.
|
com.google.api.gax.rpc.UnaryCallable<UpdateControlRequest,Control> |
updateControlCallable()
Updates a Control.
|
protected ControlServiceClient(ControlServiceSettings settings) throws IOException
IOExceptionprotected ControlServiceClient(ControlServiceStub stub)
public static final ControlServiceClient create() throws IOException
IOExceptionpublic static final ControlServiceClient create(ControlServiceSettings settings) throws IOException
IOExceptionpublic static final ControlServiceClient create(ControlServiceStub stub)
public final ControlServiceSettings getSettings()
public ControlServiceStub getStub()
public final Control createControl(DataStoreName parent, Control control, String controlId)
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
DataStoreName parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
Control control = Control.newBuilder().build();
String controlId = "controlId-395080872";
Control response = controlServiceClient.createControl(parent, control, controlId);
}
parent - Required. Full resource name of parent data store. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.control - Required. The Control to create.controlId - Required. The ID to use for the Control, which will become the final component
of the Control's resource name.
This value must be within 1-63 characters. Valid characters are /[a-z][0-9]-_/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control createControl(EngineName parent, Control control, String controlId)
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
EngineName parent = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
Control control = Control.newBuilder().build();
String controlId = "controlId-395080872";
Control response = controlServiceClient.createControl(parent, control, controlId);
}
parent - Required. Full resource name of parent data store. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.control - Required. The Control to create.controlId - Required. The ID to use for the Control, which will become the final component
of the Control's resource name.
This value must be within 1-63 characters. Valid characters are /[a-z][0-9]-_/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control createControl(String parent, Control control, String controlId)
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
String parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
Control control = Control.newBuilder().build();
String controlId = "controlId-395080872";
Control response = controlServiceClient.createControl(parent, control, controlId);
}
parent - Required. Full resource name of parent data store. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.control - Required. The Control to create.controlId - Required. The ID to use for the Control, which will become the final component
of the Control's resource name.
This value must be within 1-63 characters. Valid characters are /[a-z][0-9]-_/.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control createControl(CreateControlRequest request)
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
CreateControlRequest request =
CreateControlRequest.newBuilder()
.setParent(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setControl(Control.newBuilder().build())
.setControlId("controlId-395080872")
.build();
Control response = controlServiceClient.createControl(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<CreateControlRequest,Control> createControlCallable()
By default 1000 controls are allowed for a data store. A request can be submitted to adjust this limit. If the [Control][google.cloud.discoveryengine.v1.Control] to create already exists, an ALREADY_EXISTS error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
CreateControlRequest request =
CreateControlRequest.newBuilder()
.setParent(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setControl(Control.newBuilder().build())
.setControlId("controlId-395080872")
.build();
ApiFuture<Control> future = controlServiceClient.createControlCallable().futureCall(request);
// Do something.
Control response = future.get();
}
public final void deleteControl(ControlName name)
If the [Control][google.cloud.discoveryengine.v1.Control] to delete does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
ControlName name =
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]");
controlServiceClient.deleteControl(name);
}
name - Required. The resource name of the Control to delete. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteControl(String name)
If the [Control][google.cloud.discoveryengine.v1.Control] to delete does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
String name =
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString();
controlServiceClient.deleteControl(name);
}
name - Required. The resource name of the Control to delete. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteControl(DeleteControlRequest request)
If the [Control][google.cloud.discoveryengine.v1.Control] to delete does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
DeleteControlRequest request =
DeleteControlRequest.newBuilder()
.setName(
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString())
.build();
controlServiceClient.deleteControl(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<DeleteControlRequest,com.google.protobuf.Empty> deleteControlCallable()
If the [Control][google.cloud.discoveryengine.v1.Control] to delete does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
DeleteControlRequest request =
DeleteControlRequest.newBuilder()
.setName(
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString())
.build();
ApiFuture<Empty> future = controlServiceClient.deleteControlCallable().futureCall(request);
// Do something.
future.get();
}
public final Control updateControl(Control control, com.google.protobuf.FieldMask updateMask)
[Control][google.cloud.discoveryengine.v1.Control] action type cannot be changed. If the [Control][google.cloud.discoveryengine.v1.Control] to update does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
Control control = Control.newBuilder().build();
FieldMask updateMask = FieldMask.newBuilder().build();
Control response = controlServiceClient.updateControl(control, updateMask);
}
control - Required. The Control to update.updateMask - Optional. Indicates which fields in the provided
[Control][google.cloud.discoveryengine.v1.Control] to update. The following are NOT
supported:
If not set or empty, all supported fields are updated.
com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control updateControl(UpdateControlRequest request)
[Control][google.cloud.discoveryengine.v1.Control] action type cannot be changed. If the [Control][google.cloud.discoveryengine.v1.Control] to update does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
UpdateControlRequest request =
UpdateControlRequest.newBuilder()
.setControl(Control.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Control response = controlServiceClient.updateControl(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<UpdateControlRequest,Control> updateControlCallable()
[Control][google.cloud.discoveryengine.v1.Control] action type cannot be changed. If the [Control][google.cloud.discoveryengine.v1.Control] to update does not exist, a NOT_FOUND error is returned.
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
UpdateControlRequest request =
UpdateControlRequest.newBuilder()
.setControl(Control.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Control> future = controlServiceClient.updateControlCallable().futureCall(request);
// Do something.
Control response = future.get();
}
public final Control getControl(ControlName 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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
ControlName name =
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]");
Control response = controlServiceClient.getControl(name);
}
name - Required. The resource name of the Control to get. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control getControl(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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
String name =
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString();
Control response = controlServiceClient.getControl(name);
}
name - Required. The resource name of the Control to get. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Control getControl(GetControlRequest 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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
GetControlRequest request =
GetControlRequest.newBuilder()
.setName(
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString())
.build();
Control response = controlServiceClient.getControl(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<GetControlRequest,Control> getControlCallable()
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
GetControlRequest request =
GetControlRequest.newBuilder()
.setName(
ControlName.ofProjectLocationDataStoreControlName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[CONTROL]")
.toString())
.build();
ApiFuture<Control> future = controlServiceClient.getControlCallable().futureCall(request);
// Do something.
Control response = future.get();
}
public final ControlServiceClient.ListControlsPagedResponse listControls(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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
DataStoreName parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]");
for (Control element : controlServiceClient.listControls(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The data store resource name. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ControlServiceClient.ListControlsPagedResponse listControls(EngineName 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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
EngineName parent = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
for (Control element : controlServiceClient.listControls(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The data store resource name. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ControlServiceClient.ListControlsPagedResponse listControls(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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
String parent =
DataStoreName.ofProjectLocationDataStoreName("[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString();
for (Control element : controlServiceClient.listControls(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The data store resource name. Format:
`projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`
or
`projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ControlServiceClient.ListControlsPagedResponse listControls(ListControlsRequest 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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
ListControlsRequest request =
ListControlsRequest.newBuilder()
.setParent(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
for (Control element : controlServiceClient.listControls(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<ListControlsRequest,ControlServiceClient.ListControlsPagedResponse> listControlsPagedCallable()
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
ListControlsRequest request =
ListControlsRequest.newBuilder()
.setParent(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
ApiFuture<Control> future =
controlServiceClient.listControlsPagedCallable().futureCall(request);
// Do something.
for (Control element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListControlsRequest,ListControlsResponse> listControlsCallable()
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 (ControlServiceClient controlServiceClient = ControlServiceClient.create()) {
ListControlsRequest request =
ListControlsRequest.newBuilder()
.setParent(
DataStoreName.ofProjectLocationDataStoreName(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]")
.toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.setFilter("filter-1274492040")
.build();
while (true) {
ListControlsResponse response = controlServiceClient.listControlsCallable().call(request);
for (Control element : response.getControlsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
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 © 2025 Google LLC. All rights reserved.