Class EngineServiceClient (0.29.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().

MethodDescriptionMethod 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 [solution_type][] 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 [solution_type][] 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
TypeDescription
EngineServiceClient
Exceptions
TypeDescription
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
NameDescription
settingsEngineServiceSettings
Returns
TypeDescription
EngineServiceClient
Exceptions
TypeDescription
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
NameDescription
stubEngineServiceStub
Returns
TypeDescription
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
NameDescription
settingsEngineServiceSettings

EngineServiceClient(EngineServiceStub stub)

protected EngineServiceClient(EngineServiceStub stub)
Parameter
NameDescription
stubEngineServiceStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
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
NameDescription
parentCollectionName

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

engineEngine

Required. The Engine to create.

engineIdString

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
TypeDescription
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
NameDescription
requestCreateEngineRequest

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

Returns
TypeDescription
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
NameDescription
parentString

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

engineEngine

Required. The Engine to create.

engineIdString

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
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
requestDeleteEngineRequest

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

Returns
TypeDescription
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
NameDescription
nameEngineName

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
TypeDescription
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
NameDescription
nameString

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
TypeDescription
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
TypeDescription
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
TypeDescription
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
NameDescription
nameEngineName

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

Returns
TypeDescription
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
NameDescription
requestGetEngineRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
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
TypeDescription
OperationsClient

getSettings()

public final EngineServiceSettings getSettings()
Returns
TypeDescription
EngineServiceSettings

getStub()

public EngineServiceStub getStub()
Returns
TypeDescription
EngineServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
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
NameDescription
parentCollectionName

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

Returns
TypeDescription
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
NameDescription
requestListEnginesRequest

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

Returns
TypeDescription
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
NameDescription
parentString

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

Returns
TypeDescription
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
TypeDescription
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
TypeDescription
UnaryCallable<ListEnginesRequest,ListEnginesPagedResponse>

pauseEngine(EngineName name)

public final Engine pauseEngine(EngineName name)

Pauses the training of an existing engine. Only applicable if [solution_type][] 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
NameDescription
nameEngineName

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

Returns
TypeDescription
Engine

pauseEngine(PauseEngineRequest request)

public final Engine pauseEngine(PauseEngineRequest request)

Pauses the training of an existing engine. Only applicable if [solution_type][] 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
NameDescription
requestPauseEngineRequest

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

Returns
TypeDescription
Engine

pauseEngine(String name)

public final Engine pauseEngine(String name)

Pauses the training of an existing engine. Only applicable if [solution_type][] 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
NameDescription
nameString

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

Returns
TypeDescription
Engine

pauseEngineCallable()

public final UnaryCallable<PauseEngineRequest,Engine> pauseEngineCallable()

Pauses the training of an existing engine. Only applicable if [solution_type][] 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
TypeDescription
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
NameDescription
nameEngineName

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

Returns
TypeDescription
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
NameDescription
requestResumeEngineRequest

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

Returns
TypeDescription
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
NameDescription
nameString

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

Returns
TypeDescription
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
TypeDescription
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 [solution_type][] 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
NameDescription
nameEngineName

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

Returns
TypeDescription
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineAsync(TuneEngineRequest request)

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

Tunes an existing engine. Only applicable if [solution_type][] 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
NameDescription
requestTuneEngineRequest

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

Returns
TypeDescription
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineAsync(String name)

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

Tunes an existing engine. Only applicable if [solution_type][] 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
NameDescription
nameString

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

Returns
TypeDescription
OperationFuture<TuneEngineResponse,TuneEngineMetadata>

tuneEngineCallable()

public final UnaryCallable<TuneEngineRequest,Operation> tuneEngineCallable()

Tunes an existing engine. Only applicable if [solution_type][] 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
TypeDescription
UnaryCallable<TuneEngineRequest,Operation>

tuneEngineOperationCallable()

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

Tunes an existing engine. Only applicable if [solution_type][] 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
TypeDescription
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
NameDescription
engineEngine

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.

updateMaskFieldMask

Indicates which fields in the provided Engine to update.

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

Returns
TypeDescription
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
NameDescription
requestUpdateEngineRequest

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

Returns
TypeDescription
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
TypeDescription
UnaryCallable<UpdateEngineRequest,Engine>