Class EndpointServiceClient (2.5.3)

public class EndpointServiceClient implements BackgroundResource

Service Description: A service for managing Vertex AI's Endpoints.

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:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   EndpointName name = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
   Endpoint response = endpointServiceClient.getEndpoint(name);
 }
 

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

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of EndpointServiceSettings to create(). For example:

To customize credentials:


 EndpointServiceSettings endpointServiceSettings =
     EndpointServiceSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 EndpointServiceClient endpointServiceClient =
     EndpointServiceClient.create(endpointServiceSettings);
 

To customize the endpoint:


 EndpointServiceSettings endpointServiceSettings =
     EndpointServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 EndpointServiceClient endpointServiceClient =
     EndpointServiceClient.create(endpointServiceSettings);
 

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

Inheritance

java.lang.Object > EndpointServiceClient

Implements

BackgroundResource

Constructors

EndpointServiceClient(EndpointServiceSettings settings)

protected EndpointServiceClient(EndpointServiceSettings settings)

Constructs an instance of EndpointServiceClient, 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
settingsEndpointServiceSettings

EndpointServiceClient(EndpointServiceStub stub)

protected EndpointServiceClient(EndpointServiceStub stub)
Parameter
NameDescription
stubEndpointServiceStub

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()

create()

public static final EndpointServiceClient create()

Constructs an instance of EndpointServiceClient with default settings.

Returns
TypeDescription
EndpointServiceClient
Exceptions
TypeDescription
IOException

create(EndpointServiceSettings settings)

public static final EndpointServiceClient create(EndpointServiceSettings settings)

Constructs an instance of EndpointServiceClient, 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
settingsEndpointServiceSettings
Returns
TypeDescription
EndpointServiceClient
Exceptions
TypeDescription
IOException

create(EndpointServiceStub stub)

public static final EndpointServiceClient create(EndpointServiceStub stub)

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

Parameter
NameDescription
stubEndpointServiceStub
Returns
TypeDescription
EndpointServiceClient

createEndpointAsync(CreateEndpointRequest request)

public final OperationFuture<Endpoint,CreateEndpointOperationMetadata> createEndpointAsync(CreateEndpointRequest request)

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   CreateEndpointRequest request =
       CreateEndpointRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setEndpoint(Endpoint.newBuilder().build())
           .setEndpointId("endpointId-1837754992")
           .build();
   Endpoint response = endpointServiceClient.createEndpointAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateEndpointRequest

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

Returns
TypeDescription
OperationFuture<Endpoint,CreateEndpointOperationMetadata>

createEndpointAsync(LocationName parent, Endpoint endpoint)

public final OperationFuture<Endpoint,CreateEndpointOperationMetadata> createEndpointAsync(LocationName parent, Endpoint endpoint)

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Endpoint endpoint = Endpoint.newBuilder().build();
   Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Endpoint in. Format: projects/{project}/locations/{location}

endpointEndpoint

Required. The Endpoint to create.

Returns
TypeDescription
OperationFuture<Endpoint,CreateEndpointOperationMetadata>

createEndpointAsync(LocationName parent, Endpoint endpoint, String endpointId)

public final OperationFuture<Endpoint,CreateEndpointOperationMetadata> createEndpointAsync(LocationName parent, Endpoint endpoint, String endpointId)

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Endpoint endpoint = Endpoint.newBuilder().build();
   String endpointId = "endpointId-1837754992";
   Endpoint response =
       endpointServiceClient.createEndpointAsync(parent, endpoint, endpointId).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the Location to create the Endpoint in. Format: projects/{project}/locations/{location}

endpointEndpoint

Required. The Endpoint to create.

endpointIdString

Immutable. The ID to use for endpoint, which will become the final component of the endpoint resource name. If not provided, Vertex AI will generate a value for this ID.

This value should be 1-10 characters, and valid characters are /[0-9]/. When using HTTP/JSON, this field is populated based on a query string argument, such as ?endpoint_id=12345. This is the fallback for fields that are not included in either the URI or the body.

Returns
TypeDescription
OperationFuture<Endpoint,CreateEndpointOperationMetadata>

createEndpointAsync(String parent, Endpoint endpoint)

public final OperationFuture<Endpoint,CreateEndpointOperationMetadata> createEndpointAsync(String parent, Endpoint endpoint)

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Endpoint endpoint = Endpoint.newBuilder().build();
   Endpoint response = endpointServiceClient.createEndpointAsync(parent, endpoint).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the Location to create the Endpoint in. Format: projects/{project}/locations/{location}

endpointEndpoint

Required. The Endpoint to create.

Returns
TypeDescription
OperationFuture<Endpoint,CreateEndpointOperationMetadata>

createEndpointAsync(String parent, Endpoint endpoint, String endpointId)

public final OperationFuture<Endpoint,CreateEndpointOperationMetadata> createEndpointAsync(String parent, Endpoint endpoint, String endpointId)

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Endpoint endpoint = Endpoint.newBuilder().build();
   String endpointId = "endpointId-1837754992";
   Endpoint response =
       endpointServiceClient.createEndpointAsync(parent, endpoint, endpointId).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the Location to create the Endpoint in. Format: projects/{project}/locations/{location}

endpointEndpoint

Required. The Endpoint to create.

endpointIdString

Immutable. The ID to use for endpoint, which will become the final component of the endpoint resource name. If not provided, Vertex AI will generate a value for this ID.

This value should be 1-10 characters, and valid characters are /[0-9]/. When using HTTP/JSON, this field is populated based on a query string argument, such as ?endpoint_id=12345. This is the fallback for fields that are not included in either the URI or the body.

Returns
TypeDescription
OperationFuture<Endpoint,CreateEndpointOperationMetadata>

createEndpointCallable()

public final UnaryCallable<CreateEndpointRequest,Operation> createEndpointCallable()

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   CreateEndpointRequest request =
       CreateEndpointRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setEndpoint(Endpoint.newBuilder().build())
           .setEndpointId("endpointId-1837754992")
           .build();
   ApiFuture<Operation> future =
       endpointServiceClient.createEndpointCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateEndpointRequest,Operation>

createEndpointOperationCallable()

public final OperationCallable<CreateEndpointRequest,Endpoint,CreateEndpointOperationMetadata> createEndpointOperationCallable()

Creates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   CreateEndpointRequest request =
       CreateEndpointRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setEndpoint(Endpoint.newBuilder().build())
           .setEndpointId("endpointId-1837754992")
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<CreateEndpointRequest,Endpoint,CreateEndpointOperationMetadata>

deleteEndpointAsync(DeleteEndpointRequest request)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteEndpointAsync(DeleteEndpointRequest request)

Deletes an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeleteEndpointRequest request =
       DeleteEndpointRequest.newBuilder()
           .setName(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .build();
   endpointServiceClient.deleteEndpointAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteEndpointRequest

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

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteEndpointAsync(EndpointName name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteEndpointAsync(EndpointName name)

Deletes an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   EndpointName name = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
   endpointServiceClient.deleteEndpointAsync(name).get();
 }
 
Parameter
NameDescription
nameEndpointName

Required. The name of the Endpoint resource to be deleted. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteEndpointAsync(String name)

public final OperationFuture<Empty,DeleteOperationMetadata> deleteEndpointAsync(String name)

Deletes an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String name = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString();
   endpointServiceClient.deleteEndpointAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. The name of the Endpoint resource to be deleted. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

Returns
TypeDescription
OperationFuture<Empty,DeleteOperationMetadata>

deleteEndpointCallable()

public final UnaryCallable<DeleteEndpointRequest,Operation> deleteEndpointCallable()

Deletes an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeleteEndpointRequest request =
       DeleteEndpointRequest.newBuilder()
           .setName(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .build();
   ApiFuture<Operation> future =
       endpointServiceClient.deleteEndpointCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteEndpointRequest,Operation>

deleteEndpointOperationCallable()

public final OperationCallable<DeleteEndpointRequest,Empty,DeleteOperationMetadata> deleteEndpointOperationCallable()

Deletes an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeleteEndpointRequest request =
       DeleteEndpointRequest.newBuilder()
           .setName(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .build();
   OperationFuture
Returns
TypeDescription
OperationCallable<DeleteEndpointRequest,Empty,DeleteOperationMetadata>

deployModelAsync(DeployModelRequest request)

public final OperationFuture<DeployModelResponse,DeployModelOperationMetadata> deployModelAsync(DeployModelRequest request)

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeployModelRequest request =
       DeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModel(DeployedModel.newBuilder().build())
           .putAllTrafficSplit(new HashMap
Parameter
NameDescription
requestDeployModelRequest

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

Returns
TypeDescription
OperationFuture<DeployModelResponse,DeployModelOperationMetadata>

deployModelAsync(EndpointName endpoint, DeployedModel deployedModel, Map<String,Integer> trafficSplit)

public final OperationFuture<DeployModelResponse,DeployModelOperationMetadata> deployModelAsync(EndpointName endpoint, DeployedModel deployedModel, Map<String,Integer> trafficSplit)

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   EndpointName endpoint = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
   DeployedModel deployedModel = DeployedModel.newBuilder().build();
   Map
Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint resource into which to deploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

deployedModelDeployedModel

Required. The DeployedModel to be created within the Endpoint. Note that Endpoint.traffic_split must be updated for the DeployedModel to start receiving traffic, either as part of this call, or via EndpointService.UpdateEndpoint.

trafficSplitMap<String,Integer>

A map from a DeployedModel's ID to the percentage of this Endpoint's traffic that should be forwarded to that DeployedModel.

If this field is non-empty, then the Endpoint's traffic_split will be overwritten with it. To refer to the ID of the just being deployed Model, a "0" should be used, and the actual ID of the new DeployedModel will be filled in its place by this method. The traffic percentage values must add up to 100.

If this field is empty, then the Endpoint's traffic_split is not updated.

Returns
TypeDescription
OperationFuture<DeployModelResponse,DeployModelOperationMetadata>

deployModelAsync(String endpoint, DeployedModel deployedModel, Map<String,Integer> trafficSplit)

public final OperationFuture<DeployModelResponse,DeployModelOperationMetadata> deployModelAsync(String endpoint, DeployedModel deployedModel, Map<String,Integer> trafficSplit)

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String endpoint = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString();
   DeployedModel deployedModel = DeployedModel.newBuilder().build();
   Map
Parameters
NameDescription
endpointString

Required. The name of the Endpoint resource into which to deploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

deployedModelDeployedModel

Required. The DeployedModel to be created within the Endpoint. Note that Endpoint.traffic_split must be updated for the DeployedModel to start receiving traffic, either as part of this call, or via EndpointService.UpdateEndpoint.

trafficSplitMap<String,Integer>

A map from a DeployedModel's ID to the percentage of this Endpoint's traffic that should be forwarded to that DeployedModel.

If this field is non-empty, then the Endpoint's traffic_split will be overwritten with it. To refer to the ID of the just being deployed Model, a "0" should be used, and the actual ID of the new DeployedModel will be filled in its place by this method. The traffic percentage values must add up to 100.

If this field is empty, then the Endpoint's traffic_split is not updated.

Returns
TypeDescription
OperationFuture<DeployModelResponse,DeployModelOperationMetadata>

deployModelCallable()

public final UnaryCallable<DeployModelRequest,Operation> deployModelCallable()

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeployModelRequest request =
       DeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModel(DeployedModel.newBuilder().build())
           .putAllTrafficSplit(new HashMap
Returns
TypeDescription
UnaryCallable<DeployModelRequest,Operation>

deployModelOperationCallable()

public final OperationCallable<DeployModelRequest,DeployModelResponse,DeployModelOperationMetadata> deployModelOperationCallable()

Deploys a Model into this Endpoint, creating a DeployedModel within it.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   DeployModelRequest request =
       DeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModel(DeployedModel.newBuilder().build())
           .putAllTrafficSplit(new HashMap
Returns
TypeDescription
OperationCallable<DeployModelRequest,DeployModelResponse,DeployModelOperationMetadata>

getEndpoint(EndpointName name)

public final Endpoint getEndpoint(EndpointName name)

Gets an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   EndpointName name = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
   Endpoint response = endpointServiceClient.getEndpoint(name);
 }
 
Parameter
NameDescription
nameEndpointName

Required. The name of the Endpoint resource. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

Returns
TypeDescription
Endpoint

getEndpoint(GetEndpointRequest request)

public final Endpoint getEndpoint(GetEndpointRequest request)

Gets an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   GetEndpointRequest request =
       GetEndpointRequest.newBuilder()
           .setName(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .build();
   Endpoint response = endpointServiceClient.getEndpoint(request);
 }
 
Parameter
NameDescription
requestGetEndpointRequest

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

Returns
TypeDescription
Endpoint

getEndpoint(String name)

public final Endpoint getEndpoint(String name)

Gets an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String name = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString();
   Endpoint response = endpointServiceClient.getEndpoint(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the Endpoint resource. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

Returns
TypeDescription
Endpoint

getEndpointCallable()

public final UnaryCallable<GetEndpointRequest,Endpoint> getEndpointCallable()

Gets an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   GetEndpointRequest request =
       GetEndpointRequest.newBuilder()
           .setName(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .build();
   ApiFuture<Endpoint> future = endpointServiceClient.getEndpointCallable().futureCall(request);
   // Do something.
   Endpoint response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetEndpointRequest,Endpoint>

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 EndpointServiceSettings getSettings()
Returns
TypeDescription
EndpointServiceSettings

getStub()

public EndpointServiceStub getStub()
Returns
TypeDescription
EndpointServiceStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listEndpoints(ListEndpointsRequest request)

public final EndpointServiceClient.ListEndpointsPagedResponse listEndpoints(ListEndpointsRequest request)

Lists Endpoints in a Location.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   ListEndpointsRequest request =
       ListEndpointsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   for (Endpoint element : endpointServiceClient.listEndpoints(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListEndpointsRequest

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

Returns
TypeDescription
EndpointServiceClient.ListEndpointsPagedResponse

listEndpoints(LocationName parent)

public final EndpointServiceClient.ListEndpointsPagedResponse listEndpoints(LocationName parent)

Lists Endpoints in a Location.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the Location from which to list the Endpoints. Format: projects/{project}/locations/{location}

Returns
TypeDescription
EndpointServiceClient.ListEndpointsPagedResponse

listEndpoints(String parent)

public final EndpointServiceClient.ListEndpointsPagedResponse listEndpoints(String parent)

Lists Endpoints in a Location.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Endpoint element : endpointServiceClient.listEndpoints(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the Location from which to list the Endpoints. Format: projects/{project}/locations/{location}

Returns
TypeDescription
EndpointServiceClient.ListEndpointsPagedResponse

listEndpointsCallable()

public final UnaryCallable<ListEndpointsRequest,ListEndpointsResponse> listEndpointsCallable()

Lists Endpoints in a Location.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   ListEndpointsRequest request =
       ListEndpointsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   while (true) {
     ListEndpointsResponse response =
         endpointServiceClient.listEndpointsCallable().call(request);
     for (Endpoint element : response.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEndpointsRequest,ListEndpointsResponse>

listEndpointsPagedCallable()

public final UnaryCallable<ListEndpointsRequest,EndpointServiceClient.ListEndpointsPagedResponse> listEndpointsPagedCallable()

Lists Endpoints in a Location.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   ListEndpointsRequest request =
       ListEndpointsRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setReadMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Endpoint> future =
       endpointServiceClient.listEndpointsPagedCallable().futureCall(request);
   // Do something.
   for (Endpoint element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListEndpointsRequest,ListEndpointsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

undeployModelAsync(EndpointName endpoint, String deployedModelId, Map<String,Integer> trafficSplit)

public final OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata> undeployModelAsync(EndpointName endpoint, String deployedModelId, Map<String,Integer> trafficSplit)

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   EndpointName endpoint = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]");
   String deployedModelId = "deployedModelId-1817547906";
   Map
Parameters
NameDescription
endpointEndpointName

Required. The name of the Endpoint resource from which to undeploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

deployedModelIdString

Required. The ID of the DeployedModel to be undeployed from the Endpoint.

trafficSplitMap<String,Integer>

If this field is provided, then the Endpoint's traffic_split will be overwritten with it. If last DeployedModel is being undeployed from the Endpoint, the [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel will be successfully undeployed only if it doesn't have any traffic assigned to it when this method executes, or if this field unassigns any traffic to it.

Returns
TypeDescription
OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata>

undeployModelAsync(UndeployModelRequest request)

public final OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata> undeployModelAsync(UndeployModelRequest request)

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   UndeployModelRequest request =
       UndeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModelId("deployedModelId-1817547906")
           .putAllTrafficSplit(new HashMap
Parameter
NameDescription
requestUndeployModelRequest

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

Returns
TypeDescription
OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata>

undeployModelAsync(String endpoint, String deployedModelId, Map<String,Integer> trafficSplit)

public final OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata> undeployModelAsync(String endpoint, String deployedModelId, Map<String,Integer> trafficSplit)

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   String endpoint = EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString();
   String deployedModelId = "deployedModelId-1817547906";
   Map
Parameters
NameDescription
endpointString

Required. The name of the Endpoint resource from which to undeploy a Model. Format: projects/{project}/locations/{location}/endpoints/{endpoint}

deployedModelIdString

Required. The ID of the DeployedModel to be undeployed from the Endpoint.

trafficSplitMap<String,Integer>

If this field is provided, then the Endpoint's traffic_split will be overwritten with it. If last DeployedModel is being undeployed from the Endpoint, the [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel will be successfully undeployed only if it doesn't have any traffic assigned to it when this method executes, or if this field unassigns any traffic to it.

Returns
TypeDescription
OperationFuture<UndeployModelResponse,UndeployModelOperationMetadata>

undeployModelCallable()

public final UnaryCallable<UndeployModelRequest,Operation> undeployModelCallable()

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   UndeployModelRequest request =
       UndeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModelId("deployedModelId-1817547906")
           .putAllTrafficSplit(new HashMap
Returns
TypeDescription
UnaryCallable<UndeployModelRequest,Operation>

undeployModelOperationCallable()

public final OperationCallable<UndeployModelRequest,UndeployModelResponse,UndeployModelOperationMetadata> undeployModelOperationCallable()

Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all resources it's using.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   UndeployModelRequest request =
       UndeployModelRequest.newBuilder()
           .setEndpoint(EndpointName.of("[PROJECT]", "[LOCATION]", "[ENDPOINT]").toString())
           .setDeployedModelId("deployedModelId-1817547906")
           .putAllTrafficSplit(new HashMap
Returns
TypeDescription
OperationCallable<UndeployModelRequest,UndeployModelResponse,UndeployModelOperationMetadata>

updateEndpoint(Endpoint endpoint, FieldMask updateMask)

public final Endpoint updateEndpoint(Endpoint endpoint, FieldMask updateMask)

Updates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   Endpoint endpoint = Endpoint.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Endpoint response = endpointServiceClient.updateEndpoint(endpoint, updateMask);
 }
 
Parameters
NameDescription
endpointEndpoint

Required. The Endpoint which replaces the resource on the server.

updateMaskFieldMask

Required. The update mask applies to the resource. See google.protobuf.FieldMask.

Returns
TypeDescription
Endpoint

updateEndpoint(UpdateEndpointRequest request)

public final Endpoint updateEndpoint(UpdateEndpointRequest request)

Updates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   UpdateEndpointRequest request =
       UpdateEndpointRequest.newBuilder()
           .setEndpoint(Endpoint.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   Endpoint response = endpointServiceClient.updateEndpoint(request);
 }
 
Parameter
NameDescription
requestUpdateEndpointRequest

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

Returns
TypeDescription
Endpoint

updateEndpointCallable()

public final UnaryCallable<UpdateEndpointRequest,Endpoint> updateEndpointCallable()

Updates an Endpoint.

Sample code:


 try (EndpointServiceClient endpointServiceClient = EndpointServiceClient.create()) {
   UpdateEndpointRequest request =
       UpdateEndpointRequest.newBuilder()
           .setEndpoint(Endpoint.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<Endpoint> future =
       endpointServiceClient.updateEndpointCallable().futureCall(request);
   // Do something.
   Endpoint response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateEndpointRequest,Endpoint>