@Generated(value="by gapic-generator-java") public class VizierServiceClient extends Object implements com.google.api.gax.core.BackgroundResource
Vertex AI Vizier is a service to solve blackbox optimization problems, such as tuning machine learning hyperparameters and searching over deep learning architectures.
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Study study = Study.newBuilder().build();
Study response = vizierServiceClient.createStudy(parent, study);
}
Note: close() needs to be called on the VizierServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
The surface of this class includes several types of Java methods for each of the API's methods:
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of VizierServiceSettings 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
VizierServiceSettings vizierServiceSettings =
VizierServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings);
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
VizierServiceSettings vizierServiceSettings =
VizierServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
VizierServiceClient vizierServiceClient = VizierServiceClient.create(vizierServiceSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
VizierServiceClient.ListLocationsFixedSizeCollection |
static class |
VizierServiceClient.ListLocationsPage |
static class |
VizierServiceClient.ListLocationsPagedResponse |
static class |
VizierServiceClient.ListStudiesFixedSizeCollection |
static class |
VizierServiceClient.ListStudiesPage |
static class |
VizierServiceClient.ListStudiesPagedResponse |
static class |
VizierServiceClient.ListTrialsFixedSizeCollection |
static class |
VizierServiceClient.ListTrialsPage |
static class |
VizierServiceClient.ListTrialsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
VizierServiceClient(VizierServiceSettings settings)
Constructs an instance of VizierServiceClient, using the given settings.
|
protected |
VizierServiceClient(VizierServiceStub stub) |
| Modifier and Type | Method and Description |
|---|---|
Trial |
addTrialMeasurement(AddTrialMeasurementRequest request)
Adds a measurement of the objective metrics to a Trial.
|
com.google.api.gax.rpc.UnaryCallable<AddTrialMeasurementRequest,Trial> |
addTrialMeasurementCallable()
Adds a measurement of the objective metrics to a Trial.
|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
com.google.api.gax.longrunning.OperationFuture<CheckTrialEarlyStoppingStateResponse,CheckTrialEarlyStoppingStateMetatdata> |
checkTrialEarlyStoppingStateAsync(CheckTrialEarlyStoppingStateRequest request)
Checks whether a Trial should stop or not.
|
com.google.api.gax.rpc.UnaryCallable<CheckTrialEarlyStoppingStateRequest,com.google.longrunning.Operation> |
checkTrialEarlyStoppingStateCallable()
Checks whether a Trial should stop or not.
|
com.google.api.gax.rpc.OperationCallable<CheckTrialEarlyStoppingStateRequest,CheckTrialEarlyStoppingStateResponse,CheckTrialEarlyStoppingStateMetatdata> |
checkTrialEarlyStoppingStateOperationCallable()
Checks whether a Trial should stop or not.
|
void |
close() |
Trial |
completeTrial(CompleteTrialRequest request)
Marks a Trial as complete.
|
com.google.api.gax.rpc.UnaryCallable<CompleteTrialRequest,Trial> |
completeTrialCallable()
Marks a Trial as complete.
|
static VizierServiceClient |
create()
Constructs an instance of VizierServiceClient with default settings.
|
static VizierServiceClient |
create(VizierServiceSettings settings)
Constructs an instance of VizierServiceClient, using the given settings.
|
static VizierServiceClient |
create(VizierServiceStub stub)
Constructs an instance of VizierServiceClient, using the given stub for making calls.
|
Study |
createStudy(CreateStudyRequest request)
Creates a Study.
|
Study |
createStudy(LocationName parent,
Study study)
Creates a Study.
|
Study |
createStudy(String parent,
Study study)
Creates a Study.
|
com.google.api.gax.rpc.UnaryCallable<CreateStudyRequest,Study> |
createStudyCallable()
Creates a Study.
|
Trial |
createTrial(CreateTrialRequest request)
Adds a user provided Trial to a Study.
|
Trial |
createTrial(String parent,
Trial trial)
Adds a user provided Trial to a Study.
|
Trial |
createTrial(StudyName parent,
Trial trial)
Adds a user provided Trial to a Study.
|
com.google.api.gax.rpc.UnaryCallable<CreateTrialRequest,Trial> |
createTrialCallable()
Adds a user provided Trial to a Study.
|
void |
deleteStudy(DeleteStudyRequest request)
Deletes a Study.
|
void |
deleteStudy(String name)
Deletes a Study.
|
void |
deleteStudy(StudyName name)
Deletes a Study.
|
com.google.api.gax.rpc.UnaryCallable<DeleteStudyRequest,com.google.protobuf.Empty> |
deleteStudyCallable()
Deletes a Study.
|
void |
deleteTrial(DeleteTrialRequest request)
Deletes a Trial.
|
void |
deleteTrial(String name)
Deletes a Trial.
|
void |
deleteTrial(TrialName name)
Deletes a Trial.
|
com.google.api.gax.rpc.UnaryCallable<DeleteTrialRequest,com.google.protobuf.Empty> |
deleteTrialCallable()
Deletes a Trial.
|
com.google.iam.v1.Policy |
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Gets the access control policy for a resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> |
getIamPolicyCallable()
Gets the access control policy for a resource.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
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.
|
VizierServiceSettings |
getSettings() |
VizierServiceStub |
getStub() |
Study |
getStudy(GetStudyRequest request)
Gets a Study by name.
|
Study |
getStudy(String name)
Gets a Study by name.
|
Study |
getStudy(StudyName name)
Gets a Study by name.
|
com.google.api.gax.rpc.UnaryCallable<GetStudyRequest,Study> |
getStudyCallable()
Gets a Study by name.
|
Trial |
getTrial(GetTrialRequest request)
Gets a Trial.
|
Trial |
getTrial(String name)
Gets a Trial.
|
Trial |
getTrial(TrialName name)
Gets a Trial.
|
com.google.api.gax.rpc.UnaryCallable<GetTrialRequest,Trial> |
getTrialCallable()
Gets a Trial.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
VizierServiceClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,VizierServiceClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
ListOptimalTrialsResponse |
listOptimalTrials(ListOptimalTrialsRequest request)
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for
single-objective Study.
|
ListOptimalTrialsResponse |
listOptimalTrials(String parent)
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for
single-objective Study.
|
ListOptimalTrialsResponse |
listOptimalTrials(StudyName parent)
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for
single-objective Study.
|
com.google.api.gax.rpc.UnaryCallable<ListOptimalTrialsRequest,ListOptimalTrialsResponse> |
listOptimalTrialsCallable()
Lists the pareto-optimal Trials for multi-objective Study or the optimal Trials for
single-objective Study.
|
VizierServiceClient.ListStudiesPagedResponse |
listStudies(ListStudiesRequest request)
Lists all the studies in a region for an associated project.
|
VizierServiceClient.ListStudiesPagedResponse |
listStudies(LocationName parent)
Lists all the studies in a region for an associated project.
|
VizierServiceClient.ListStudiesPagedResponse |
listStudies(String parent)
Lists all the studies in a region for an associated project.
|
com.google.api.gax.rpc.UnaryCallable<ListStudiesRequest,ListStudiesResponse> |
listStudiesCallable()
Lists all the studies in a region for an associated project.
|
com.google.api.gax.rpc.UnaryCallable<ListStudiesRequest,VizierServiceClient.ListStudiesPagedResponse> |
listStudiesPagedCallable()
Lists all the studies in a region for an associated project.
|
VizierServiceClient.ListTrialsPagedResponse |
listTrials(ListTrialsRequest request)
Lists the Trials associated with a Study.
|
VizierServiceClient.ListTrialsPagedResponse |
listTrials(String parent)
Lists the Trials associated with a Study.
|
VizierServiceClient.ListTrialsPagedResponse |
listTrials(StudyName parent)
Lists the Trials associated with a Study.
|
com.google.api.gax.rpc.UnaryCallable<ListTrialsRequest,ListTrialsResponse> |
listTrialsCallable()
Lists the Trials associated with a Study.
|
com.google.api.gax.rpc.UnaryCallable<ListTrialsRequest,VizierServiceClient.ListTrialsPagedResponse> |
listTrialsPagedCallable()
Lists the Trials associated with a Study.
|
Study |
lookupStudy(LocationName parent)
Looks a study up using the user-defined display_name field instead of the fully qualified
resource name.
|
Study |
lookupStudy(LookupStudyRequest request)
Looks a study up using the user-defined display_name field instead of the fully qualified
resource name.
|
Study |
lookupStudy(String parent)
Looks a study up using the user-defined display_name field instead of the fully qualified
resource name.
|
com.google.api.gax.rpc.UnaryCallable<LookupStudyRequest,Study> |
lookupStudyCallable()
Looks a study up using the user-defined display_name field instead of the fully qualified
resource name.
|
com.google.iam.v1.Policy |
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Sets the access control policy on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> |
setIamPolicyCallable()
Sets the access control policy on the specified resource.
|
void |
shutdown() |
void |
shutdownNow() |
Trial |
stopTrial(StopTrialRequest request)
Stops a Trial.
|
com.google.api.gax.rpc.UnaryCallable<StopTrialRequest,Trial> |
stopTrialCallable()
Stops a Trial.
|
com.google.api.gax.longrunning.OperationFuture<SuggestTrialsResponse,SuggestTrialsMetadata> |
suggestTrialsAsync(SuggestTrialsRequest request)
Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.
|
com.google.api.gax.rpc.UnaryCallable<SuggestTrialsRequest,com.google.longrunning.Operation> |
suggestTrialsCallable()
Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.
|
com.google.api.gax.rpc.OperationCallable<SuggestTrialsRequest,SuggestTrialsResponse,SuggestTrialsMetadata> |
suggestTrialsOperationCallable()
Adds one or more Trials to a Study, with parameter values suggested by Vertex AI Vizier.
|
com.google.iam.v1.TestIamPermissionsResponse |
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Returns permissions that a caller has on the specified resource.
|
com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> |
testIamPermissionsCallable()
Returns permissions that a caller has on the specified resource.
|
protected VizierServiceClient(VizierServiceSettings settings) throws IOException
IOExceptionprotected VizierServiceClient(VizierServiceStub stub)
public static final VizierServiceClient create() throws IOException
IOExceptionpublic static final VizierServiceClient create(VizierServiceSettings settings) throws IOException
IOExceptionpublic static final VizierServiceClient create(VizierServiceStub stub)
public final VizierServiceSettings getSettings()
public VizierServiceStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
public final Study createStudy(LocationName parent, Study study)
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Study study = Study.newBuilder().build();
Study response = vizierServiceClient.createStudy(parent, study);
}
parent - Required. The resource name of the Location to create the CustomJob in. Format:
`projects/{project}/locations/{location}`study - Required. The Study configuration used to create the Study.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study createStudy(String parent, Study study)
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Study study = Study.newBuilder().build();
Study response = vizierServiceClient.createStudy(parent, study);
}
parent - Required. The resource name of the Location to create the CustomJob in. Format:
`projects/{project}/locations/{location}`study - Required. The Study configuration used to create the Study.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study createStudy(CreateStudyRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CreateStudyRequest request =
CreateStudyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setStudy(Study.newBuilder().build())
.build();
Study response = vizierServiceClient.createStudy(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<CreateStudyRequest,Study> createStudyCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CreateStudyRequest request =
CreateStudyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setStudy(Study.newBuilder().build())
.build();
ApiFuture<Study> future = vizierServiceClient.createStudyCallable().futureCall(request);
// Do something.
Study response = future.get();
}
public final Study getStudy(StudyName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]");
Study response = vizierServiceClient.getStudy(name);
}
name - Required. The name of the Study resource. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study getStudy(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString();
Study response = vizierServiceClient.getStudy(name);
}
name - Required. The name of the Study resource. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study getStudy(GetStudyRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetStudyRequest request =
GetStudyRequest.newBuilder()
.setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
Study response = vizierServiceClient.getStudy(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<GetStudyRequest,Study> getStudyCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetStudyRequest request =
GetStudyRequest.newBuilder()
.setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
ApiFuture<Study> future = vizierServiceClient.getStudyCallable().futureCall(request);
// Do something.
Study response = future.get();
}
public final VizierServiceClient.ListStudiesPagedResponse listStudies(LocationName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Location to list the Study from. Format:
`projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final VizierServiceClient.ListStudiesPagedResponse listStudies(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Study element : vizierServiceClient.listStudies(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Location to list the Study from. Format:
`projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final VizierServiceClient.ListStudiesPagedResponse listStudies(ListStudiesRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListStudiesRequest request =
ListStudiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for (Study element : vizierServiceClient.listStudies(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<ListStudiesRequest,VizierServiceClient.ListStudiesPagedResponse> listStudiesPagedCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListStudiesRequest request =
ListStudiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<Study> future = vizierServiceClient.listStudiesPagedCallable().futureCall(request);
// Do something.
for (Study element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListStudiesRequest,ListStudiesResponse> listStudiesCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListStudiesRequest request =
ListStudiesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
ListStudiesResponse response = vizierServiceClient.listStudiesCallable().call(request);
for (Study element : response.getStudiesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final void deleteStudy(StudyName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StudyName name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]");
vizierServiceClient.deleteStudy(name);
}
name - Required. The name of the Study resource to be deleted. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteStudy(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String name = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString();
vizierServiceClient.deleteStudy(name);
}
name - Required. The name of the Study resource to be deleted. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteStudy(DeleteStudyRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
DeleteStudyRequest request =
DeleteStudyRequest.newBuilder()
.setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
vizierServiceClient.deleteStudy(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<DeleteStudyRequest,com.google.protobuf.Empty> deleteStudyCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
DeleteStudyRequest request =
DeleteStudyRequest.newBuilder()
.setName(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
ApiFuture<Empty> future = vizierServiceClient.deleteStudyCallable().futureCall(request);
// Do something.
future.get();
}
public final Study lookupStudy(LocationName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Study response = vizierServiceClient.lookupStudy(parent);
}
parent - Required. The resource name of the Location to get the Study from. Format:
`projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study lookupStudy(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
Study response = vizierServiceClient.lookupStudy(parent);
}
parent - Required. The resource name of the Location to get the Study from. Format:
`projects/{project}/locations/{location}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Study lookupStudy(LookupStudyRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LookupStudyRequest request =
LookupStudyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDisplayName("displayName1714148973")
.build();
Study response = vizierServiceClient.lookupStudy(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<LookupStudyRequest,Study> lookupStudyCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
LookupStudyRequest request =
LookupStudyRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setDisplayName("displayName1714148973")
.build();
ApiFuture<Study> future = vizierServiceClient.lookupStudyCallable().futureCall(request);
// Do something.
Study response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<SuggestTrialsResponse,SuggestTrialsMetadata> suggestTrialsAsync(SuggestTrialsRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
SuggestTrialsRequest request =
SuggestTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setSuggestionCount(390130452)
.setClientId("clientId908408390")
.addAllContexts(new ArrayList<TrialContext>())
.build();
SuggestTrialsResponse response = vizierServiceClient.suggestTrialsAsync(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<SuggestTrialsRequest,SuggestTrialsResponse,SuggestTrialsMetadata> suggestTrialsOperationCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
SuggestTrialsRequest request =
SuggestTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setSuggestionCount(390130452)
.setClientId("clientId908408390")
.addAllContexts(new ArrayList<TrialContext>())
.build();
OperationFuture<SuggestTrialsResponse, SuggestTrialsMetadata> future =
vizierServiceClient.suggestTrialsOperationCallable().futureCall(request);
// Do something.
SuggestTrialsResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<SuggestTrialsRequest,com.google.longrunning.Operation> suggestTrialsCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
SuggestTrialsRequest request =
SuggestTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setSuggestionCount(390130452)
.setClientId("clientId908408390")
.addAllContexts(new ArrayList<TrialContext>())
.build();
ApiFuture<Operation> future = vizierServiceClient.suggestTrialsCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Trial createTrial(StudyName parent, Trial trial)
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]");
Trial trial = Trial.newBuilder().build();
Trial response = vizierServiceClient.createTrial(parent, trial);
}
parent - Required. The resource name of the Study to create the Trial in. Format:
`projects/{project}/locations/{location}/studies/{study}`trial - Required. The Trial to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Trial createTrial(String parent, Trial trial)
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString();
Trial trial = Trial.newBuilder().build();
Trial response = vizierServiceClient.createTrial(parent, trial);
}
parent - Required. The resource name of the Study to create the Trial in. Format:
`projects/{project}/locations/{location}/studies/{study}`trial - Required. The Trial to create.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Trial createTrial(CreateTrialRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CreateTrialRequest request =
CreateTrialRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setTrial(Trial.newBuilder().build())
.build();
Trial response = vizierServiceClient.createTrial(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<CreateTrialRequest,Trial> createTrialCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CreateTrialRequest request =
CreateTrialRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setTrial(Trial.newBuilder().build())
.build();
ApiFuture<Trial> future = vizierServiceClient.createTrialCallable().futureCall(request);
// Do something.
Trial response = future.get();
}
public final Trial getTrial(TrialName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]");
Trial response = vizierServiceClient.getTrial(name);
}
name - Required. The name of the Trial resource. Format:
`projects/{project}/locations/{location}/studies/{study}/trials/{trial}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Trial getTrial(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString();
Trial response = vizierServiceClient.getTrial(name);
}
name - Required. The name of the Trial resource. Format:
`projects/{project}/locations/{location}/studies/{study}/trials/{trial}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final Trial getTrial(GetTrialRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetTrialRequest request =
GetTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
Trial response = vizierServiceClient.getTrial(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<GetTrialRequest,Trial> getTrialCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetTrialRequest request =
GetTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
ApiFuture<Trial> future = vizierServiceClient.getTrialCallable().futureCall(request);
// Do something.
Trial response = future.get();
}
public final VizierServiceClient.ListTrialsPagedResponse listTrials(StudyName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]");
for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Study to list the Trial from. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final VizierServiceClient.ListTrialsPagedResponse listTrials(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString();
for (Trial element : vizierServiceClient.listTrials(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the Study to list the Trial from. Format:
`projects/{project}/locations/{location}/studies/{study}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final VizierServiceClient.ListTrialsPagedResponse listTrials(ListTrialsRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListTrialsRequest request =
ListTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
for (Trial element : vizierServiceClient.listTrials(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<ListTrialsRequest,VizierServiceClient.ListTrialsPagedResponse> listTrialsPagedCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListTrialsRequest request =
ListTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
ApiFuture<Trial> future = vizierServiceClient.listTrialsPagedCallable().futureCall(request);
// Do something.
for (Trial element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListTrialsRequest,ListTrialsResponse> listTrialsCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListTrialsRequest request =
ListTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.setPageToken("pageToken873572522")
.setPageSize(883849137)
.build();
while (true) {
ListTrialsResponse response = vizierServiceClient.listTrialsCallable().call(request);
for (Trial element : response.getTrialsList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Trial addTrialMeasurement(AddTrialMeasurementRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
AddTrialMeasurementRequest request =
AddTrialMeasurementRequest.newBuilder()
.setTrialName(
TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.setMeasurement(Measurement.newBuilder().build())
.build();
Trial response = vizierServiceClient.addTrialMeasurement(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<AddTrialMeasurementRequest,Trial> addTrialMeasurementCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
AddTrialMeasurementRequest request =
AddTrialMeasurementRequest.newBuilder()
.setTrialName(
TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.setMeasurement(Measurement.newBuilder().build())
.build();
ApiFuture<Trial> future =
vizierServiceClient.addTrialMeasurementCallable().futureCall(request);
// Do something.
Trial response = future.get();
}
public final Trial completeTrial(CompleteTrialRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CompleteTrialRequest request =
CompleteTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.setFinalMeasurement(Measurement.newBuilder().build())
.setTrialInfeasible(true)
.setInfeasibleReason("infeasibleReason1040725388")
.build();
Trial response = vizierServiceClient.completeTrial(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<CompleteTrialRequest,Trial> completeTrialCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CompleteTrialRequest request =
CompleteTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.setFinalMeasurement(Measurement.newBuilder().build())
.setTrialInfeasible(true)
.setInfeasibleReason("infeasibleReason1040725388")
.build();
ApiFuture<Trial> future = vizierServiceClient.completeTrialCallable().futureCall(request);
// Do something.
Trial response = future.get();
}
public final void deleteTrial(TrialName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
TrialName name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]");
vizierServiceClient.deleteTrial(name);
}
name - Required. The Trial's name. Format:
`projects/{project}/locations/{location}/studies/{study}/trials/{trial}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTrial(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String name = TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString();
vizierServiceClient.deleteTrial(name);
}
name - Required. The Trial's name. Format:
`projects/{project}/locations/{location}/studies/{study}/trials/{trial}`com.google.api.gax.rpc.ApiException - if the remote call failspublic final void deleteTrial(DeleteTrialRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
DeleteTrialRequest request =
DeleteTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
vizierServiceClient.deleteTrial(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<DeleteTrialRequest,com.google.protobuf.Empty> deleteTrialCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
DeleteTrialRequest request =
DeleteTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
ApiFuture<Empty> future = vizierServiceClient.deleteTrialCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<CheckTrialEarlyStoppingStateResponse,CheckTrialEarlyStoppingStateMetatdata> checkTrialEarlyStoppingStateAsync(CheckTrialEarlyStoppingStateRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CheckTrialEarlyStoppingStateRequest request =
CheckTrialEarlyStoppingStateRequest.newBuilder()
.setTrialName(
TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
CheckTrialEarlyStoppingStateResponse response =
vizierServiceClient.checkTrialEarlyStoppingStateAsync(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<CheckTrialEarlyStoppingStateRequest,CheckTrialEarlyStoppingStateResponse,CheckTrialEarlyStoppingStateMetatdata> checkTrialEarlyStoppingStateOperationCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CheckTrialEarlyStoppingStateRequest request =
CheckTrialEarlyStoppingStateRequest.newBuilder()
.setTrialName(
TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
OperationFuture<CheckTrialEarlyStoppingStateResponse, CheckTrialEarlyStoppingStateMetatdata>
future =
vizierServiceClient
.checkTrialEarlyStoppingStateOperationCallable()
.futureCall(request);
// Do something.
CheckTrialEarlyStoppingStateResponse response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CheckTrialEarlyStoppingStateRequest,com.google.longrunning.Operation> checkTrialEarlyStoppingStateCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
CheckTrialEarlyStoppingStateRequest request =
CheckTrialEarlyStoppingStateRequest.newBuilder()
.setTrialName(
TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
ApiFuture<Operation> future =
vizierServiceClient.checkTrialEarlyStoppingStateCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final Trial stopTrial(StopTrialRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StopTrialRequest request =
StopTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
Trial response = vizierServiceClient.stopTrial(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<StopTrialRequest,Trial> stopTrialCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StopTrialRequest request =
StopTrialRequest.newBuilder()
.setName(TrialName.of("[PROJECT]", "[LOCATION]", "[STUDY]", "[TRIAL]").toString())
.build();
ApiFuture<Trial> future = vizierServiceClient.stopTrialCallable().futureCall(request);
// Do something.
Trial response = future.get();
}
public final ListOptimalTrialsResponse listOptimalTrials(StudyName 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
StudyName parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]");
ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent);
}
parent - Required. The name of the Study that the optimal Trial belongs to.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ListOptimalTrialsResponse listOptimalTrials(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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
String parent = StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString();
ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(parent);
}
parent - Required. The name of the Study that the optimal Trial belongs to.com.google.api.gax.rpc.ApiException - if the remote call failspublic final ListOptimalTrialsResponse listOptimalTrials(ListOptimalTrialsRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListOptimalTrialsRequest request =
ListOptimalTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
ListOptimalTrialsResponse response = vizierServiceClient.listOptimalTrials(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<ListOptimalTrialsRequest,ListOptimalTrialsResponse> listOptimalTrialsCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListOptimalTrialsRequest request =
ListOptimalTrialsRequest.newBuilder()
.setParent(StudyName.of("[PROJECT]", "[LOCATION]", "[STUDY]").toString())
.build();
ApiFuture<ListOptimalTrialsResponse> future =
vizierServiceClient.listOptimalTrialsCallable().futureCall(request);
// Do something.
ListOptimalTrialsResponse response = future.get();
}
public final VizierServiceClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : vizierServiceClient.listLocations(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<com.google.cloud.location.ListLocationsRequest,VizierServiceClient.ListLocationsPagedResponse> listLocationsPagedCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
vizierServiceClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = vizierServiceClient.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;
}
}
}
public final com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest 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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = vizierServiceClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
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 (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = vizierServiceClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
Policy response = vizierServiceClient.setIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
SetIamPolicyRequest request =
SetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setPolicy(Policy.newBuilder().build())
.setUpdateMask(FieldMask.newBuilder().build())
.build();
ApiFuture<Policy> future = vizierServiceClient.setIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
Policy response = vizierServiceClient.getIamPolicy(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
GetIamPolicyRequest request =
GetIamPolicyRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.setOptions(GetPolicyOptions.newBuilder().build())
.build();
ApiFuture<Policy> future = vizierServiceClient.getIamPolicyCallable().futureCall(request);
// Do something.
Policy response = future.get();
}
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
TestIamPermissionsResponse response = vizierServiceClient.testIamPermissions(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (VizierServiceClient vizierServiceClient = VizierServiceClient.create()) {
TestIamPermissionsRequest request =
TestIamPermissionsRequest.newBuilder()
.setResource(
EndpointName.ofProjectLocationEndpointName(
"[PROJECT]", "[LOCATION]", "[ENDPOINT]")
.toString())
.addAllPermissions(new ArrayList<String>())
.build();
ApiFuture<TestIamPermissionsResponse> future =
vizierServiceClient.testIamPermissionsCallable().futureCall(request);
// Do something.
TestIamPermissionsResponse response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2023 Google LLC. All rights reserved.