2222import com .google .cloud .aiplatform .v1 .EndpointName ;
2323import com .google .cloud .aiplatform .v1 .EndpointServiceClient ;
2424import com .google .cloud .aiplatform .v1 .EndpointServiceSettings ;
25- import com .google .cloud .aiplatform .v1 .ModelName ;
2625import com .google .cloud .aiplatform .v1 .UndeployModelOperationMetadata ;
2726import com .google .cloud .aiplatform .v1 .UndeployModelResponse ;
2827import java .io .IOException ;
@@ -57,7 +56,6 @@ static void undeployModelSample(String project, String endpointId, String modelI
5756 EndpointServiceClient .create (endpointServiceSettings )) {
5857 String location = "us-central1" ;
5958 EndpointName endpointName = EndpointName .of (project , location , endpointId );
60- ModelName modelName = ModelName .of (project , location , modelId );
6159
6260 // key '0' assigns traffic for the newly deployed model
6361 // Traffic percentage values must add up to 100
@@ -66,7 +64,7 @@ static void undeployModelSample(String project, String endpointId, String modelI
6664
6765 OperationFuture <UndeployModelResponse , UndeployModelOperationMetadata > operation =
6866 endpointServiceClient .undeployModelAsync (
69- endpointName .toString (), modelName . toString () , trafficSplit );
67+ endpointName .toString (), modelId , trafficSplit );
7068 System .out .format ("Operation name: %s\n " , operation .getInitialFuture ().get ().getName ());
7169 System .out .println ("Waiting for operation to finish..." );
7270 UndeployModelResponse undeployModelResponse = operation .get (180 , TimeUnit .SECONDS );
0 commit comments