22
22
import com .google .cloud .aiplatform .v1 .EndpointName ;
23
23
import com .google .cloud .aiplatform .v1 .EndpointServiceClient ;
24
24
import com .google .cloud .aiplatform .v1 .EndpointServiceSettings ;
25
- import com .google .cloud .aiplatform .v1 .ModelName ;
26
25
import com .google .cloud .aiplatform .v1 .UndeployModelOperationMetadata ;
27
26
import com .google .cloud .aiplatform .v1 .UndeployModelResponse ;
28
27
import java .io .IOException ;
@@ -57,7 +56,6 @@ static void undeployModelSample(String project, String endpointId, String modelI
57
56
EndpointServiceClient .create (endpointServiceSettings )) {
58
57
String location = "us-central1" ;
59
58
EndpointName endpointName = EndpointName .of (project , location , endpointId );
60
- ModelName modelName = ModelName .of (project , location , modelId );
61
59
62
60
// key '0' assigns traffic for the newly deployed model
63
61
// Traffic percentage values must add up to 100
@@ -66,7 +64,7 @@ static void undeployModelSample(String project, String endpointId, String modelI
66
64
67
65
OperationFuture <UndeployModelResponse , UndeployModelOperationMetadata > operation =
68
66
endpointServiceClient .undeployModelAsync (
69
- endpointName .toString (), modelName . toString () , trafficSplit );
67
+ endpointName .toString (), modelId , trafficSplit );
70
68
System .out .format ("Operation name: %s\n " , operation .getInitialFuture ().get ().getName ());
71
69
System .out .println ("Waiting for operation to finish..." );
72
70
UndeployModelResponse undeployModelResponse = operation .get (180 , TimeUnit .SECONDS );
0 commit comments