Class EngineServiceClient (0.51.0)

GitHub RepositoryProduct Reference

Service Description: Service for managing Engine configuration.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   Engine engine = Engine.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Engine response = engineServiceClient.updateEngine(engine, updateMask);
 }
 

Note: close() needs to be called on the EngineServiceClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

Methods
Method Description Method Variants

CreateEngine

Creates a Engine.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • createEngineAsync(CreateEngineRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • createEngineAsync(CollectionName parent, Engine engine, String engineId)

  • createEngineAsync(String parent, Engine engine, String engineId)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • createEngineOperationCallable()

  • createEngineCallable()

DeleteEngine

Deletes a Engine.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteEngineAsync(DeleteEngineRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteEngineAsync(EngineName name)

  • deleteEngineAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteEngineOperationCallable()

  • deleteEngineCallable()

UpdateEngine

Updates an Engine

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • updateEngine(UpdateEngineRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • updateEngine(Engine engine, FieldMask updateMask)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • updateEngineCallable()

GetEngine

Gets a Engine.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • getEngine(GetEngineRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • getEngine(EngineName name)

  • getEngine(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getEngineCallable()

ListEngines

Lists all the Engines associated with the project.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listEngines(ListEnginesRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listEngines(CollectionName parent)

  • listEngines(String parent)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listEnginesPagedCallable()

  • listEnginesCallable()

PauseEngine

Pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • pauseEngine(PauseEngineRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • pauseEngine(EngineName name)

  • pauseEngine(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • pauseEngineCallable()

ResumeEngine

Resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • resumeEngine(ResumeEngineRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • resumeEngine(EngineName name)

  • resumeEngine(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • resumeEngineCallable()

TuneEngine

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • tuneEngineAsync(TuneEngineRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • tuneEngineAsync(EngineName name)

  • tuneEngineAsync(String name)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • tuneEngineOperationCallable()

  • tuneEngineCallable()

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 EngineServiceSettings 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
 EngineServiceSettings engineServiceSettings =
     EngineServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 EngineServiceClient engineServiceClient = EngineServiceClient.create(engineServiceSettings);
 

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
 EngineServiceSettings engineServiceSettings =
     EngineServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 EngineServiceClient engineServiceClient = EngineServiceClient.create(engineServiceSettings);
 

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
 EngineServiceSettings engineServiceSettings =
     EngineServiceSettings.newHttpJsonBuilder().build();
 EngineServiceClient engineServiceClient = EngineServiceClient.create(engineServiceSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > EngineServiceClient

Static Methods

create()

public static final EngineServiceClient create()

Constructs an instance of EngineServiceClient with default settings.

Returns
Type Description
EngineServiceClient
Exceptions
Type Description
IOException

create(EngineServiceSettings settings)

public static final EngineServiceClient create(EngineServiceSettings settings)

Constructs an instance of EngineServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
Name Description
settings EngineServiceSettings
Returns
Type Description
EngineServiceClient
Exceptions
Type Description
IOException

create(EngineServiceStub stub)

public static final EngineServiceClient create(EngineServiceStub stub)

Constructs an instance of EngineServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(EngineServiceSettings).

Parameter
Name Description
stub EngineServiceStub
Returns
Type Description
EngineServiceClient

Constructors

EngineServiceClient(EngineServiceSettings settings)

protected EngineServiceClient(EngineServiceSettings settings)

Constructs an instance of EngineServiceClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
Name Description
settings EngineServiceSettings

EngineServiceClient(EngineServiceStub stub)

protected EngineServiceClient(EngineServiceStub stub)
Parameter
Name Description
stub EngineServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

createEngineAsync(CollectionName parent, Engine engine, String engineId)

public final OperationFuture<Engine,CreateEngineMetadata> createEngineAsync(CollectionName parent, Engine engine, String engineId)

Creates a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
   Engine engine = Engine.newBuilder().build();
   String engineId = "engineId1820490493";
   Engine response = engineServiceClient.createEngineAsync(parent, engine, engineId).get();
 }
 
Parameters
Name Description
parent CollectionName

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}.

engine Engine

Required. The Engine to create.

engineId String

Required. The ID to use for the Engine, which will become the final component of the Engine's resource name.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Returns
Type Description
OperationFuture<Engine,CreateEngineMetadata>

createEngineAsync(CreateEngineRequest request)

public final OperationFuture<Engine,CreateEngineMetadata> createEngineAsync(CreateEngineRequest request)

Creates a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   CreateEngineRequest request =
       CreateEngineRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setEngine(Engine.newBuilder().build())
           .setEngineId("engineId1820490493")
           .build();
   Engine response = engineServiceClient.createEngineAsync(request).get();
 }
 
Parameter
Name Description
request CreateEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Engine,CreateEngineMetadata>

createEngineAsync(String parent, Engine engine, String engineId)

public final OperationFuture<Engine,CreateEngineMetadata> createEngineAsync(String parent, Engine engine, String engineId)

Creates a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString();
   Engine engine = Engine.newBuilder().build();
   String engineId = "engineId1820490493";
   Engine response = engineServiceClient.createEngineAsync(parent, engine, engineId).get();
 }
 
Parameters
Name Description
parent String

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection}.

engine Engine

Required. The Engine to create.

engineId String

Required. The ID to use for the Engine, which will become the final component of the Engine's resource name.

This field must conform to RFC-1034 standard with a length limit of 63 characters. Otherwise, an INVALID_ARGUMENT error is returned.

Returns
Type Description
OperationFuture<Engine,CreateEngineMetadata>

createEngineCallable()

public final UnaryCallable<CreateEngineRequest,Operation> createEngineCallable()

Creates a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   CreateEngineRequest request =
       CreateEngineRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setEngine(Engine.newBuilder().build())
           .setEngineId("engineId1820490493")
           .build();
   ApiFuture<Operation> future = engineServiceClient.createEngineCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<CreateEngineRequest,Operation>

createEngineOperationCallable()

public final OperationCallable<CreateEngineRequest,Engine,CreateEngineMetadata> createEngineOperationCallable()

Creates a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   CreateEngineRequest request =
       CreateEngineRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setEngine(Engine.newBuilder().build())
           .setEngineId("engineId1820490493")
           .build();
   OperationFuture<Engine, CreateEngineMetadata> future =
       engineServiceClient.createEngineOperationCallable().futureCall(request);
   // Do something.
   Engine response = future.get();
 }
 
Returns
Type Description
OperationCallable<CreateEngineRequest,Engine,CreateEngineMetadata>

deleteEngineAsync(DeleteEngineRequest request)

public final OperationFuture<Empty,DeleteEngineMetadata> deleteEngineAsync(DeleteEngineRequest request)

Deletes a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   DeleteEngineRequest request =
       DeleteEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   engineServiceClient.deleteEngineAsync(request).get();
 }
 
Parameter
Name Description
request DeleteEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<Empty,DeleteEngineMetadata>

deleteEngineAsync(EngineName name)

public final OperationFuture<Empty,DeleteEngineMetadata> deleteEngineAsync(EngineName name)

Deletes a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   EngineName name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
   engineServiceClient.deleteEngineAsync(name).get();
 }
 
Parameter
Name Description
name EngineName

Required. Full resource name of Engine, such as projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

If the caller does not have permission to delete the Engine, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Engine to delete does not exist, a NOT_FOUND error is returned.

Returns
Type Description
OperationFuture<Empty,DeleteEngineMetadata>

deleteEngineAsync(String name)

public final OperationFuture<Empty,DeleteEngineMetadata> deleteEngineAsync(String name)

Deletes a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString();
   engineServiceClient.deleteEngineAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. Full resource name of Engine, such as projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

If the caller does not have permission to delete the Engine, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Engine to delete does not exist, a NOT_FOUND error is returned.

Returns
Type Description
OperationFuture<Empty,DeleteEngineMetadata>

deleteEngineCallable()

public final UnaryCallable<DeleteEngineRequest,Operation> deleteEngineCallable()

Deletes a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   DeleteEngineRequest request =
       DeleteEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   ApiFuture<Operation> future = engineServiceClient.deleteEngineCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
UnaryCallable<DeleteEngineRequest,Operation>

deleteEngineOperationCallable()

public final OperationCallable<DeleteEngineRequest,Empty,DeleteEngineMetadata> deleteEngineOperationCallable()

Deletes a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   DeleteEngineRequest request =
       DeleteEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   OperationFuture<Empty, DeleteEngineMetadata> future =
       engineServiceClient.deleteEngineOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
Type Description
OperationCallable<DeleteEngineRequest,Empty,DeleteEngineMetadata>

getEngine(EngineName name)

public final Engine getEngine(EngineName name)

Gets a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   EngineName name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
   Engine response = engineServiceClient.getEngine(name);
 }
 
Parameter
Name Description
name EngineName

Required. Full resource name of Engine, such as projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Returns
Type Description
Engine

getEngine(GetEngineRequest request)

public final Engine getEngine(GetEngineRequest request)

Gets a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   GetEngineRequest request =
       GetEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   Engine response = engineServiceClient.getEngine(request);
 }
 
Parameter
Name Description
request GetEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Engine

getEngine(String name)

public final Engine getEngine(String name)

Gets a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString();
   Engine response = engineServiceClient.getEngine(name);
 }
 
Parameter
Name Description
name String

Required. Full resource name of Engine, such as projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}.

Returns
Type Description
Engine

getEngineCallable()

public final UnaryCallable<GetEngineRequest,Engine> getEngineCallable()

Gets a Engine.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   GetEngineRequest request =
       GetEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   ApiFuture<Engine> future = engineServiceClient.getEngineCallable().futureCall(request);
   // Do something.
   Engine response = future.get();
 }
 
Returns
Type Description
UnaryCallable<GetEngineRequest,Engine>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
Type Description
OperationsClient

getSettings()

public final EngineServiceSettings getSettings()
Returns
Type Description
EngineServiceSettings

getStub()

public EngineServiceStub getStub()
Returns
Type Description
EngineServiceStub

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listEngines(CollectionName parent)

public final EngineServiceClient.ListEnginesPagedResponse listEngines(CollectionName parent)

Lists all the Engines associated with the project.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   CollectionName parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]");
   for (Engine element : engineServiceClient.listEngines(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent CollectionName

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection_id}.

Returns
Type Description
EngineServiceClient.ListEnginesPagedResponse

listEngines(ListEnginesRequest request)

public final EngineServiceClient.ListEnginesPagedResponse listEngines(ListEnginesRequest request)

Lists all the Engines associated with the project.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   ListEnginesRequest request =
       ListEnginesRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   for (Engine element : engineServiceClient.listEngines(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
request ListEnginesRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
EngineServiceClient.ListEnginesPagedResponse

listEngines(String parent)

public final EngineServiceClient.ListEnginesPagedResponse listEngines(String parent)

Lists all the Engines associated with the project.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String parent = CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString();
   for (Engine element : engineServiceClient.listEngines(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

Required. The parent resource name, such as projects/{project}/locations/{location}/collections/{collection_id}.

Returns
Type Description
EngineServiceClient.ListEnginesPagedResponse

listEnginesCallable()

public final UnaryCallable<ListEnginesRequest,ListEnginesResponse> listEnginesCallable()

Lists all the Engines associated with the project.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   ListEnginesRequest request =
       ListEnginesRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   while (true) {
     ListEnginesResponse response = engineServiceClient.listEnginesCallable().call(request);
     for (Engine element : response.getEnginesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListEnginesRequest,ListEnginesResponse>

listEnginesPagedCallable()

public final UnaryCallable<ListEnginesRequest,EngineServiceClient.ListEnginesPagedResponse> listEnginesPagedCallable()

Lists all the Engines associated with the project.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   ListEnginesRequest request =
       ListEnginesRequest.newBuilder()
           .setParent(CollectionName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<Engine> future = engineServiceClient.listEnginesPagedCallable().futureCall(request);
   // Do something.
   for (Engine element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
Type Description
UnaryCallable<ListEnginesRequest,ListEnginesPagedResponse>

pauseEngine(EngineName name)

public final Engine pauseEngine(EngineName name)

Pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   EngineName name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
   Engine response = engineServiceClient.pauseEngine(name);
 }
 
Parameter
Name Description
name EngineName

Required. The name of the engine to pause. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
Engine

pauseEngine(PauseEngineRequest request)

public final Engine pauseEngine(PauseEngineRequest request)

Pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   PauseEngineRequest request =
       PauseEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   Engine response = engineServiceClient.pauseEngine(request);
 }
 
Parameter
Name Description
request PauseEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Engine

pauseEngine(String name)

public final Engine pauseEngine(String name)

Pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString();
   Engine response = engineServiceClient.pauseEngine(name);
 }
 
Parameter
Name Description
name String

Required. The name of the engine to pause. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
Engine

pauseEngineCallable()

public final UnaryCallable<PauseEngineRequest,Engine> pauseEngineCallable()

Pauses the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   PauseEngineRequest request =
       PauseEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   ApiFuture<Engine> future = engineServiceClient.pauseEngineCallable().futureCall(request);
   // Do something.
   Engine response = future.get();
 }
 
Returns
Type Description
UnaryCallable<PauseEngineRequest,Engine>

resumeEngine(EngineName name)

public final Engine resumeEngine(EngineName name)

Resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   EngineName name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
   Engine response = engineServiceClient.resumeEngine(name);
 }
 
Parameter
Name Description
name EngineName

Required. The name of the engine to resume. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
Engine

resumeEngine(ResumeEngineRequest request)

public final Engine resumeEngine(ResumeEngineRequest request)

Resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   ResumeEngineRequest request =
       ResumeEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   Engine response = engineServiceClient.resumeEngine(request);
 }
 
Parameter
Name Description
request ResumeEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Engine

resumeEngine(String name)

public final Engine resumeEngine(String name)

Resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString();
   Engine response = engineServiceClient.resumeEngine(name);
 }
 
Parameter
Name Description
name String

Required. The name of the engine to resume. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
Engine

resumeEngineCallable()

public final UnaryCallable<ResumeEngineRequest,Engine> resumeEngineCallable()

Resumes the training of an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   ResumeEngineRequest request =
       ResumeEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   ApiFuture<Engine> future = engineServiceClient.resumeEngineCallable().futureCall(request);
   // Do something.
   Engine response = future.get();
 }
 
Returns
Type Description
UnaryCallable<ResumeEngineRequest,Engine>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

tuneEngineAsync(EngineName name)

public final OperationFuture<TuneEngineResponse,TuneEngineMetadata> tuneEngineAsync(EngineName name)

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   EngineName name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]");
   TuneEngineResponse response = engineServiceClient.tuneEngineAsync(name).get();
 }
 
Parameter
Name Description
name EngineName

Required. The resource name of the engine to tune. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineAsync(TuneEngineRequest request)

public final OperationFuture<TuneEngineResponse,TuneEngineMetadata> tuneEngineAsync(TuneEngineRequest request)

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   TuneEngineRequest request =
       TuneEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   TuneEngineResponse response = engineServiceClient.tuneEngineAsync(request).get();
 }
 
Parameter
Name Description
request TuneEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineAsync(String name)

public final OperationFuture<TuneEngineResponse,TuneEngineMetadata> tuneEngineAsync(String name)

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   String name = EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString();
   TuneEngineResponse response = engineServiceClient.tuneEngineAsync(name).get();
 }
 
Parameter
Name Description
name String

Required. The resource name of the engine to tune. Format: projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}

Returns
Type Description
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineCallable()

public final UnaryCallable<TuneEngineRequest,Operation> tuneEngineCallable()

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   TuneEngineRequest request =
       TuneEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   ApiFuture<Operation> future = engineServiceClient.tuneEngineCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<TuneEngineRequest,Operation>

tuneEngineOperationCallable()

public final OperationCallable<TuneEngineRequest,TuneEngineResponse,TuneEngineMetadata> tuneEngineOperationCallable()

Tunes an existing engine. Only applicable if SolutionType is SOLUTION_TYPE_RECOMMENDATION.

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   TuneEngineRequest request =
       TuneEngineRequest.newBuilder()
           .setName(
               EngineName.of("[PROJECT]", "[LOCATION]", "[COLLECTION]", "[ENGINE]").toString())
           .build();
   OperationFuture<TuneEngineResponse, TuneEngineMetadata> future =
       engineServiceClient.tuneEngineOperationCallable().futureCall(request);
   // Do something.
   TuneEngineResponse response = future.get();
 }
 
Returns
Type Description
OperationCallable<TuneEngineRequest,TuneEngineResponse,TuneEngineMetadata>

updateEngine(Engine engine, FieldMask updateMask)

public final Engine updateEngine(Engine engine, FieldMask updateMask)

Updates an Engine

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   Engine engine = Engine.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Engine response = engineServiceClient.updateEngine(engine, updateMask);
 }
 
Parameters
Name Description
engine Engine

Required. The Engine to update.

If the caller does not have permission to update the Engine, regardless of whether or not it exists, a PERMISSION_DENIED error is returned.

If the Engine to update does not exist, a NOT_FOUND error is returned.

updateMask FieldMask

Indicates which fields in the provided Engine to update.

If an unsupported or unknown field is provided, an INVALID_ARGUMENT error is returned.

Returns
Type Description
Engine

updateEngine(UpdateEngineRequest request)

public final Engine updateEngine(UpdateEngineRequest request)

Updates an Engine

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   UpdateEngineRequest request =
       UpdateEngineRequest.newBuilder()
           .setEngine(Engine.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Engine response = engineServiceClient.updateEngine(request);
 }
 
Parameter
Name Description
request UpdateEngineRequest

The request object containing all of the parameters for the API call.

Returns
Type Description
Engine

updateEngineCallable()

public final UnaryCallable<UpdateEngineRequest,Engine> updateEngineCallable()

Updates an Engine

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 (EngineServiceClient engineServiceClient = EngineServiceClient.create()) {
   UpdateEngineRequest request =
       UpdateEngineRequest.newBuilder()
           .setEngine(Engine.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Engine> future = engineServiceClient.updateEngineCallable().futureCall(request);
   // Do something.
   Engine response = future.get();
 }
 
Returns
Type Description
UnaryCallable<UpdateEngineRequest,Engine>