1919import com .google .api .core .ApiFuture ;
2020import com .google .api .core .ApiFutures ;
2121import com .google .api .gax .core .BackgroundResource ;
22+ import com .google .api .gax .longrunning .OperationFuture ;
2223import com .google .api .gax .paging .AbstractFixedSizeCollection ;
2324import com .google .api .gax .paging .AbstractPage ;
2425import com .google .api .gax .paging .AbstractPagedListResponse ;
26+ import com .google .api .gax .rpc .OperationCallable ;
2527import com .google .api .gax .rpc .PageContext ;
2628import com .google .api .gax .rpc .UnaryCallable ;
2729import com .google .cloud .aiplatform .v1 .stub .GenAiTuningServiceStub ;
3638import com .google .iam .v1 .SetIamPolicyRequest ;
3739import com .google .iam .v1 .TestIamPermissionsRequest ;
3840import com .google .iam .v1 .TestIamPermissionsResponse ;
41+ import com .google .longrunning .Operation ;
42+ import com .google .longrunning .OperationsClient ;
3943import com .google .protobuf .Empty ;
4044import java .io .IOException ;
4145import java .util .List ;
151155 * </td>
152156 * </tr>
153157 * <tr>
158+ * <td><p> RebaseTunedModel</td>
159+ * <td><p> Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model Reference and creates a TuningJob based on newly available model.</td>
160+ * <td>
161+ * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p>
162+ * <ul>
163+ * <li><p> rebaseTunedModelAsync(RebaseTunedModelRequest request)
164+ * </ul>
165+ * <p>Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.</p>
166+ * <ul>
167+ * <li><p> rebaseTunedModelAsync(LocationName parent, TunedModelRef tunedModelRef)
168+ * <li><p> rebaseTunedModelAsync(String parent, TunedModelRef tunedModelRef)
169+ * </ul>
170+ * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p>
171+ * <ul>
172+ * <li><p> rebaseTunedModelOperationCallable()
173+ * <li><p> rebaseTunedModelCallable()
174+ * </ul>
175+ * </td>
176+ * </tr>
177+ * <tr>
154178 * <td><p> ListLocations</td>
155179 * <td><p> Lists information about the supported locations for this service.</td>
156180 * <td>
270294public class GenAiTuningServiceClient implements BackgroundResource {
271295 private final GenAiTuningServiceSettings settings ;
272296 private final GenAiTuningServiceStub stub ;
297+ private final OperationsClient operationsClient ;
273298
274299 /** Constructs an instance of GenAiTuningServiceClient with default settings. */
275300 public static final GenAiTuningServiceClient create () throws IOException {
@@ -301,11 +326,13 @@ public static final GenAiTuningServiceClient create(GenAiTuningServiceStub stub)
301326 protected GenAiTuningServiceClient (GenAiTuningServiceSettings settings ) throws IOException {
302327 this .settings = settings ;
303328 this .stub = ((GenAiTuningServiceStubSettings ) settings .getStubSettings ()).createStub ();
329+ this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
304330 }
305331
306332 protected GenAiTuningServiceClient (GenAiTuningServiceStub stub ) {
307333 this .settings = null ;
308334 this .stub = stub ;
335+ this .operationsClient = OperationsClient .create (this .stub .getOperationsStub ());
309336 }
310337
311338 public final GenAiTuningServiceSettings getSettings () {
@@ -316,6 +343,14 @@ public GenAiTuningServiceStub getStub() {
316343 return stub ;
317344 }
318345
346+ /**
347+ * Returns the OperationsClient that can be used to query the status of a long-running operation
348+ * returned by another API method call.
349+ */
350+ public final OperationsClient getOperationsClient () {
351+ return operationsClient ;
352+ }
353+
319354 // AUTO-GENERATED DOCUMENTATION AND METHOD.
320355 /**
321356 * Creates a TuningJob. A created TuningJob right away will be attempted to be run.
@@ -856,6 +891,180 @@ public final UnaryCallable<CancelTuningJobRequest, Empty> cancelTuningJobCallabl
856891 return stub .cancelTuningJobCallable ();
857892 }
858893
894+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
895+ /**
896+ * Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model
897+ * Reference and creates a TuningJob based on newly available model.
898+ *
899+ * <p>Sample code:
900+ *
901+ * <pre>{@code
902+ * // This snippet has been automatically generated and should be regarded as a code template only.
903+ * // It will require modifications to work:
904+ * // - It may require correct/in-range values for request initialization.
905+ * // - It may require specifying regional endpoints when creating the service client as shown in
906+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
907+ * try (GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.create()) {
908+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
909+ * TunedModelRef tunedModelRef = TunedModelRef.newBuilder().build();
910+ * TuningJob response =
911+ * genAiTuningServiceClient.rebaseTunedModelAsync(parent, tunedModelRef).get();
912+ * }
913+ * }</pre>
914+ *
915+ * @param parent Required. The resource name of the Location into which to rebase the Model.
916+ * Format: `projects/{project}/locations/{location}`
917+ * @param tunedModelRef Required. TunedModel reference to retrieve the legacy model information.
918+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
919+ */
920+ public final OperationFuture <TuningJob , RebaseTunedModelOperationMetadata > rebaseTunedModelAsync (
921+ LocationName parent , TunedModelRef tunedModelRef ) {
922+ RebaseTunedModelRequest request =
923+ RebaseTunedModelRequest .newBuilder ()
924+ .setParent (parent == null ? null : parent .toString ())
925+ .setTunedModelRef (tunedModelRef )
926+ .build ();
927+ return rebaseTunedModelAsync (request );
928+ }
929+
930+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
931+ /**
932+ * Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model
933+ * Reference and creates a TuningJob based on newly available model.
934+ *
935+ * <p>Sample code:
936+ *
937+ * <pre>{@code
938+ * // This snippet has been automatically generated and should be regarded as a code template only.
939+ * // It will require modifications to work:
940+ * // - It may require correct/in-range values for request initialization.
941+ * // - It may require specifying regional endpoints when creating the service client as shown in
942+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
943+ * try (GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.create()) {
944+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
945+ * TunedModelRef tunedModelRef = TunedModelRef.newBuilder().build();
946+ * TuningJob response =
947+ * genAiTuningServiceClient.rebaseTunedModelAsync(parent, tunedModelRef).get();
948+ * }
949+ * }</pre>
950+ *
951+ * @param parent Required. The resource name of the Location into which to rebase the Model.
952+ * Format: `projects/{project}/locations/{location}`
953+ * @param tunedModelRef Required. TunedModel reference to retrieve the legacy model information.
954+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
955+ */
956+ public final OperationFuture <TuningJob , RebaseTunedModelOperationMetadata > rebaseTunedModelAsync (
957+ String parent , TunedModelRef tunedModelRef ) {
958+ RebaseTunedModelRequest request =
959+ RebaseTunedModelRequest .newBuilder ()
960+ .setParent (parent )
961+ .setTunedModelRef (tunedModelRef )
962+ .build ();
963+ return rebaseTunedModelAsync (request );
964+ }
965+
966+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
967+ /**
968+ * Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model
969+ * Reference and creates a TuningJob based on newly available model.
970+ *
971+ * <p>Sample code:
972+ *
973+ * <pre>{@code
974+ * // This snippet has been automatically generated and should be regarded as a code template only.
975+ * // It will require modifications to work:
976+ * // - It may require correct/in-range values for request initialization.
977+ * // - It may require specifying regional endpoints when creating the service client as shown in
978+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
979+ * try (GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.create()) {
980+ * RebaseTunedModelRequest request =
981+ * RebaseTunedModelRequest.newBuilder()
982+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
983+ * .setTunedModelRef(TunedModelRef.newBuilder().build())
984+ * .setTuningJob(TuningJob.newBuilder().build())
985+ * .setArtifactDestination(GcsDestination.newBuilder().build())
986+ * .setDeployToSameEndpoint(true)
987+ * .build();
988+ * TuningJob response = genAiTuningServiceClient.rebaseTunedModelAsync(request).get();
989+ * }
990+ * }</pre>
991+ *
992+ * @param request The request object containing all of the parameters for the API call.
993+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
994+ */
995+ public final OperationFuture <TuningJob , RebaseTunedModelOperationMetadata > rebaseTunedModelAsync (
996+ RebaseTunedModelRequest request ) {
997+ return rebaseTunedModelOperationCallable ().futureCall (request );
998+ }
999+
1000+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1001+ /**
1002+ * Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model
1003+ * Reference and creates a TuningJob based on newly available model.
1004+ *
1005+ * <p>Sample code:
1006+ *
1007+ * <pre>{@code
1008+ * // This snippet has been automatically generated and should be regarded as a code template only.
1009+ * // It will require modifications to work:
1010+ * // - It may require correct/in-range values for request initialization.
1011+ * // - It may require specifying regional endpoints when creating the service client as shown in
1012+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1013+ * try (GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.create()) {
1014+ * RebaseTunedModelRequest request =
1015+ * RebaseTunedModelRequest.newBuilder()
1016+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1017+ * .setTunedModelRef(TunedModelRef.newBuilder().build())
1018+ * .setTuningJob(TuningJob.newBuilder().build())
1019+ * .setArtifactDestination(GcsDestination.newBuilder().build())
1020+ * .setDeployToSameEndpoint(true)
1021+ * .build();
1022+ * OperationFuture<TuningJob, RebaseTunedModelOperationMetadata> future =
1023+ * genAiTuningServiceClient.rebaseTunedModelOperationCallable().futureCall(request);
1024+ * // Do something.
1025+ * TuningJob response = future.get();
1026+ * }
1027+ * }</pre>
1028+ */
1029+ public final OperationCallable <
1030+ RebaseTunedModelRequest , TuningJob , RebaseTunedModelOperationMetadata >
1031+ rebaseTunedModelOperationCallable () {
1032+ return stub .rebaseTunedModelOperationCallable ();
1033+ }
1034+
1035+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
1036+ /**
1037+ * Rebase a TunedModel. Creates a LongRunningOperation that takes a legacy Tuned GenAI model
1038+ * Reference and creates a TuningJob based on newly available model.
1039+ *
1040+ * <p>Sample code:
1041+ *
1042+ * <pre>{@code
1043+ * // This snippet has been automatically generated and should be regarded as a code template only.
1044+ * // It will require modifications to work:
1045+ * // - It may require correct/in-range values for request initialization.
1046+ * // - It may require specifying regional endpoints when creating the service client as shown in
1047+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
1048+ * try (GenAiTuningServiceClient genAiTuningServiceClient = GenAiTuningServiceClient.create()) {
1049+ * RebaseTunedModelRequest request =
1050+ * RebaseTunedModelRequest.newBuilder()
1051+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
1052+ * .setTunedModelRef(TunedModelRef.newBuilder().build())
1053+ * .setTuningJob(TuningJob.newBuilder().build())
1054+ * .setArtifactDestination(GcsDestination.newBuilder().build())
1055+ * .setDeployToSameEndpoint(true)
1056+ * .build();
1057+ * ApiFuture<Operation> future =
1058+ * genAiTuningServiceClient.rebaseTunedModelCallable().futureCall(request);
1059+ * // Do something.
1060+ * Operation response = future.get();
1061+ * }
1062+ * }</pre>
1063+ */
1064+ public final UnaryCallable <RebaseTunedModelRequest , Operation > rebaseTunedModelCallable () {
1065+ return stub .rebaseTunedModelCallable ();
1066+ }
1067+
8591068 // AUTO-GENERATED DOCUMENTATION AND METHOD.
8601069 /**
8611070 * Lists information about the supported locations for this service.
0 commit comments